[code health] Replace ASSERT() with DCHECK() in fpdfsdk/

Bug: pdfium:1596
Change-Id: I7acd005321d626514388f98e05e31d1c5a82682a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/77610
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_actionhandler.cpp b/fpdfsdk/cpdfsdk_actionhandler.cpp
index ca68a4c..0477b03 100644
--- a/fpdfsdk/cpdfsdk_actionhandler.cpp
+++ b/fpdfsdk/cpdfsdk_actionhandler.cpp
@@ -16,6 +16,7 @@
 #include "fpdfsdk/cpdfsdk_interactiveform.h"
 #include "fxjs/ijs_event_context.h"
 #include "fxjs/ijs_runtime.h"
+#include "third_party/base/check.h"
 #include "third_party/base/notreached.h"
 #include "third_party/base/stl_util.h"
 
@@ -47,7 +48,7 @@
     CPDFSDK_FormFillEnvironment* pFormFillEnv,
     CPDF_FormField* pFormField,
     CPDFSDK_FieldAction* data) {
-  ASSERT(pFormFillEnv);
+  DCHECK(pFormFillEnv);
   if (pFormFillEnv->IsJSPlatformPresent() &&
       JsAction.GetType() == CPDF_Action::JavaScript) {
     WideString swJS = JsAction.GetJavaScript();
@@ -64,7 +65,7 @@
     CPDF_AAction::AActionType type,
     CPDFSDK_FormFillEnvironment* form_fill_env,
     int modifiers) {
-  ASSERT(form_fill_env);
+  DCHECK(form_fill_env);
 
   if (!CPDF_AAction::IsUserInput(type))
     return false;
@@ -84,9 +85,9 @@
 bool CPDFSDK_ActionHandler::DoAction_Destination(
     const CPDF_Dest& dest,
     CPDFSDK_FormFillEnvironment* form_fill_env) {
-  ASSERT(form_fill_env);
+  DCHECK(form_fill_env);
   CPDF_Document* document = form_fill_env->GetPDFDocument();
-  ASSERT(document);
+  DCHECK(document);
 
   const CPDF_Array* dest_array = dest.GetArray();
   std::vector<float> dest_positions;
@@ -140,7 +141,7 @@
 
   visited->insert(pDict);
 
-  ASSERT(pFormFillEnv);
+  DCHECK(pFormFillEnv);
   if (action.GetType() == CPDF_Action::JavaScript) {
     if (pFormFillEnv->IsJSPlatformPresent()) {
       WideString swJS = action.GetJavaScript();
@@ -172,7 +173,7 @@
 
   visited->insert(pDict);
 
-  ASSERT(pFormFillEnv);
+  DCHECK(pFormFillEnv);
   if (action.GetType() == CPDF_Action::JavaScript) {
     if (pFormFillEnv->IsJSPlatformPresent()) {
       WideString swJS = action.GetJavaScript();
@@ -183,7 +184,7 @@
     DoAction_NoJs(action, type, pFormFillEnv, /*modifiers=*/0);
   }
 
-  ASSERT(pFormFillEnv);
+  DCHECK(pFormFillEnv);
 
   for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) {
     CPDF_Action subaction = action.GetSubAction(i);
@@ -197,7 +198,7 @@
 bool CPDFSDK_ActionHandler::IsValidField(
     CPDFSDK_FormFillEnvironment* pFormFillEnv,
     CPDF_Dictionary* pFieldDict) {
-  ASSERT(pFieldDict);
+  DCHECK(pFieldDict);
 
   CPDFSDK_InteractiveForm* pForm = pFormFillEnv->GetInteractiveForm();
   CPDF_InteractiveForm* pPDFForm = pForm->GetInteractiveForm();
@@ -217,7 +218,7 @@
 
   visited->insert(pDict);
 
-  ASSERT(pFormFillEnv);
+  DCHECK(pFormFillEnv);
   if (action.GetType() == CPDF_Action::JavaScript) {
     if (pFormFillEnv->IsJSPlatformPresent()) {
       WideString swJS = action.GetJavaScript();
@@ -246,7 +247,7 @@
     CPDF_AAction::AActionType type,
     CPDFSDK_FormFillEnvironment* pFormFillEnv,
     int modifiers) {
-  ASSERT(pFormFillEnv);
+  DCHECK(pFormFillEnv);
 
   switch (action.GetType()) {
     case CPDF_Action::GoTo:
@@ -293,10 +294,10 @@
 void CPDFSDK_ActionHandler::DoAction_GoTo(
     CPDFSDK_FormFillEnvironment* pFormFillEnv,
     const CPDF_Action& action) {
-  ASSERT(action.GetDict());
+  DCHECK(action.GetDict());
 
   CPDF_Document* pPDFDocument = pFormFillEnv->GetPDFDocument();
-  ASSERT(pPDFDocument);
+  DCHECK(pPDFDocument);
 
   CPDF_Dest MyDest = action.GetDest(pPDFDocument);
   DoAction_Destination(MyDest, pFormFillEnv);
@@ -306,7 +307,7 @@
     CPDFSDK_FormFillEnvironment* pFormFillEnv,
     const CPDF_Action& action,
     int modifiers) {
-  ASSERT(action.GetDict());
+  DCHECK(action.GetDict());
 
   ByteString sURI = action.GetURI(pFormFillEnv->GetPDFDocument());
   pFormFillEnv->DoURIAction(sURI.c_str(), modifiers);
@@ -315,7 +316,7 @@
 void CPDFSDK_ActionHandler::DoAction_Named(
     CPDFSDK_FormFillEnvironment* pFormFillEnv,
     const CPDF_Action& action) {
-  ASSERT(action.GetDict());
+  DCHECK(action.GetDict());
 
   ByteString csName = action.GetNamedAction();
   pFormFillEnv->ExecuteNamedAction(csName.c_str());
@@ -327,8 +328,8 @@
     CPDF_AAction::AActionType type,
     CPDFSDK_FieldAction* data,
     const WideString& script) {
-  ASSERT(type != CPDF_AAction::kCalculate);
-  ASSERT(type != CPDF_AAction::kFormat);
+  DCHECK(type != CPDF_AAction::kCalculate);
+  DCHECK(type != CPDF_AAction::kFormat);
 
   RunScript(pFormFillEnv, script,
             [type, data, pFormField](IJS_EventContext* context) {
diff --git a/fpdfsdk/cpdfsdk_annot.cpp b/fpdfsdk/cpdfsdk_annot.cpp
index 110b94c..8ac6df1 100644
--- a/fpdfsdk/cpdfsdk_annot.cpp
+++ b/fpdfsdk/cpdfsdk_annot.cpp
@@ -7,10 +7,11 @@
 #include "fpdfsdk/cpdfsdk_annot.h"
 
 #include "fpdfsdk/cpdfsdk_pageview.h"
+#include "third_party/base/check.h"
 
 CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView)
     : m_pPageView(pPageView) {
-  ASSERT(m_pPageView);
+  DCHECK(m_pPageView);
 }
 
 CPDFSDK_Annot::~CPDFSDK_Annot() = default;
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index 790ba15..980bf68 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -21,6 +21,7 @@
 #include "fpdfsdk/cpdfsdk_widgethandler.h"
 #include "fpdfsdk/pwl/cpwl_wnd.h"
 #include "public/fpdf_fwlevent.h"
+#include "third_party/base/check.h"
 
 #ifdef PDF_ENABLE_XFA
 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
@@ -35,8 +36,8 @@
     : m_pBAAnnotHandler(std::move(pBAAnnotHandler)),
       m_pWidgetHandler(std::move(pWidgetHandler)),
       m_pXFAWidgetHandler(std::move(pXFAWidgetHandler)) {
-  ASSERT(m_pBAAnnotHandler);
-  ASSERT(m_pWidgetHandler);
+  DCHECK(m_pBAAnnotHandler);
+  DCHECK(m_pWidgetHandler);
 }
 
 CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() = default;
@@ -52,7 +53,7 @@
 std::unique_ptr<CPDFSDK_Annot> CPDFSDK_AnnotHandlerMgr::NewAnnot(
     CPDF_Annot* pAnnot,
     CPDFSDK_PageView* pPageView) {
-  ASSERT(pPageView);
+  DCHECK(pPageView);
   return GetAnnotHandlerOfType(pAnnot->GetSubtype())
       ->NewAnnot(pAnnot, pPageView);
 }
@@ -61,8 +62,8 @@
 std::unique_ptr<CPDFSDK_Annot> CPDFSDK_AnnotHandlerMgr::NewXFAAnnot(
     CXFA_FFWidget* pAnnot,
     CPDFSDK_PageView* pPageView) {
-  ASSERT(pAnnot);
-  ASSERT(pPageView);
+  DCHECK(pAnnot);
+  DCHECK(pPageView);
   return static_cast<CPDFXFA_WidgetHandler*>(m_pXFAWidgetHandler.get())
       ->NewAnnotForXFA(pAnnot, pPageView);
 }
@@ -75,7 +76,7 @@
 }
 
 void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) {
-  ASSERT(pAnnot);
+  DCHECK(pAnnot);
   GetAnnotHandler(pAnnot)->OnLoad(pAnnot);
 }
 
@@ -136,7 +137,7 @@
                                            CFX_RenderDevice* pDevice,
                                            const CFX_Matrix& mtUser2Device,
                                            bool bDrawAnnots) {
-  ASSERT(pAnnot);
+  DCHECK(pAnnot);
   GetAnnotHandler(pAnnot)->OnDraw(pPageView, pAnnot, pDevice, mtUser2Device,
                                   bDrawAnnots);
 }
@@ -146,7 +147,7 @@
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
-  ASSERT(pAnnot->HasObservable());
+  DCHECK(pAnnot->HasObservable());
   return GetAnnotHandler(pAnnot->Get())
       ->OnLButtonDown(pPageView, pAnnot, nFlags, point);
 }
@@ -156,7 +157,7 @@
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
-  ASSERT(pAnnot->HasObservable());
+  DCHECK(pAnnot->HasObservable());
   return GetAnnotHandler(pAnnot->Get())
       ->OnLButtonUp(pPageView, pAnnot, nFlags, point);
 }
@@ -166,7 +167,7 @@
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
-  ASSERT(pAnnot->HasObservable());
+  DCHECK(pAnnot->HasObservable());
   return GetAnnotHandler(pAnnot->Get())
       ->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
 }
@@ -176,7 +177,7 @@
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
-  ASSERT(pAnnot->HasObservable());
+  DCHECK(pAnnot->HasObservable());
   return GetAnnotHandler(pAnnot->Get())
       ->OnMouseMove(pPageView, pAnnot, nFlags, point);
 }
@@ -187,7 +188,7 @@
     uint32_t nFlags,
     const CFX_PointF& point,
     const CFX_Vector& delta) {
-  ASSERT(pAnnot->HasObservable());
+  DCHECK(pAnnot->HasObservable());
   auto* handler = GetAnnotHandler(pAnnot->Get());
   return handler->OnMouseWheel(pPageView, pAnnot, nFlags, point, delta);
 }
@@ -197,7 +198,7 @@
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
-  ASSERT(pAnnot->HasObservable());
+  DCHECK(pAnnot->HasObservable());
   return GetAnnotHandler(pAnnot->Get())
       ->OnRButtonDown(pPageView, pAnnot, nFlags, point);
 }
@@ -207,7 +208,7 @@
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
-  ASSERT(pAnnot->HasObservable());
+  DCHECK(pAnnot->HasObservable());
   return GetAnnotHandler(pAnnot->Get())
       ->OnRButtonUp(pPageView, pAnnot, nFlags, point);
 }
@@ -216,7 +217,7 @@
     CPDFSDK_PageView* pPageView,
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlag) {
-  ASSERT(pAnnot->HasObservable());
+  DCHECK(pAnnot->HasObservable());
   GetAnnotHandler(pAnnot->Get())->OnMouseEnter(pPageView, pAnnot, nFlag);
 }
 
@@ -224,7 +225,7 @@
     CPDFSDK_PageView* pPageView,
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlag) {
-  ASSERT(pAnnot->HasObservable());
+  DCHECK(pAnnot->HasObservable());
   GetAnnotHandler(pAnnot->Get())->OnMouseExit(pPageView, pAnnot, nFlag);
 }
 
@@ -278,14 +279,14 @@
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlag) {
-  ASSERT(pAnnot->HasObservable());
+  DCHECK(pAnnot->HasObservable());
   return GetAnnotHandler(pAnnot->Get())->OnSetFocus(pAnnot, nFlag);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlag) {
-  ASSERT(pAnnot->HasObservable());
+  DCHECK(pAnnot->HasObservable());
   return GetAnnotHandler(pAnnot->Get())->OnKillFocus(pAnnot, nFlag);
 }
 
@@ -320,14 +321,14 @@
 CFX_FloatRect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox(
     CPDFSDK_PageView* pPageView,
     CPDFSDK_Annot* pAnnot) {
-  ASSERT(pAnnot);
+  DCHECK(pAnnot);
   return GetAnnotHandler(pAnnot)->GetViewBBox(pPageView, pAnnot);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView* pPageView,
                                               CPDFSDK_Annot* pAnnot,
                                               const CFX_PointF& point) {
-  ASSERT(pAnnot);
+  DCHECK(pAnnot);
   IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot);
   if (pAnnotHandler->CanAnswer(pAnnot))
     return pAnnotHandler->HitTest(pPageView, pAnnot, point);
diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp
index b60014d..72551ee 100644
--- a/fpdfsdk/cpdfsdk_baannot.cpp
+++ b/fpdfsdk/cpdfsdk_baannot.cpp
@@ -18,6 +18,7 @@
 #include "core/fpdfapi/parser/cpdf_string.h"
 #include "core/fpdfapi/parser/fpdf_parser_decode.h"
 #include "fpdfsdk/cpdfsdk_pageview.h"
+#include "third_party/base/check.h"
 
 CPDFSDK_BAAnnot::CPDFSDK_BAAnnot(CPDF_Annot* pAnnot,
                                  CPDFSDK_PageView* pPageView)
@@ -50,8 +51,8 @@
 }
 
 void CPDFSDK_BAAnnot::SetRect(const CFX_FloatRect& rect) {
-  ASSERT(rect.right - rect.left >= 1.0f);
-  ASSERT(rect.top - rect.bottom >= 1.0f);
+  DCHECK(rect.right - rect.left >= 1.0f);
+  DCHECK(rect.top - rect.bottom >= 1.0f);
   GetAnnotDict()->SetRectFor(pdfium::annotation::kRect, rect);
 }
 
diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp
index e27dd7b..48872bd 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler.cpp
@@ -20,6 +20,7 @@
 #include "fpdfsdk/cpdfsdk_pageview.h"
 #include "fpdfsdk/formfiller/cffl_formfiller.h"
 #include "public/fpdf_fwlevent.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 namespace {
@@ -176,7 +177,7 @@
 bool CPDFSDK_BAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot,
                                        int nKeyCode,
                                        int nFlag) {
-  ASSERT(pAnnot);
+  DCHECK(pAnnot);
 
   // OnKeyDown() is implemented only for link annotations for now. As
   // OnKeyDown() is implemented for other subtypes, following check should be
@@ -208,7 +209,7 @@
 
 bool CPDFSDK_BAAnnotHandler::IsFocusableAnnot(
     const CPDF_Annot::Subtype& annot_type) const {
-  ASSERT(annot_type != CPDF_Annot::Subtype::WIDGET);
+  DCHECK(annot_type != CPDF_Annot::Subtype::WIDGET);
 
   return pdfium::Contains(form_fill_environment_->GetFocusableAnnotSubtypes(),
                           annot_type);
@@ -297,7 +298,7 @@
 bool CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView,
                                      CPDFSDK_Annot* pAnnot,
                                      const CFX_PointF& point) {
-  ASSERT(pPageView);
-  ASSERT(pAnnot);
+  DCHECK(pPageView);
+  DCHECK(pAnnot);
   return GetViewBBox(pPageView, pAnnot).Contains(point);
 }
diff --git a/fpdfsdk/cpdfsdk_baannothandler_embeddertest.cpp b/fpdfsdk/cpdfsdk_baannothandler_embeddertest.cpp
index 8b48313..245d500 100644
--- a/fpdfsdk/cpdfsdk_baannothandler_embeddertest.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler_embeddertest.cpp
@@ -10,6 +10,7 @@
 #include "fpdfsdk/cpdfsdk_helpers.h"
 #include "fpdfsdk/cpdfsdk_pageview.h"
 #include "testing/embedder_test.h"
+#include "third_party/base/check.h"
 #include "third_party/base/check_op.h"
 
 class CPDFSDK_BAAnnotHandlerTest : public EmbedderTest {
@@ -54,11 +55,11 @@
     CPDFSDK_AnnotIterator ai(GetPageView(),
                              m_pFormFillEnv->GetFocusableAnnotSubtypes());
     CPDFSDK_Annot* pAnnot = ai.GetFirstAnnot();
-    ASSERT(pAnnot);
+    DCHECK(pAnnot);
 
     for (size_t i = 1; i < n; i++) {
       pAnnot = ai.GetNextAnnot(pAnnot);
-      ASSERT(pAnnot);
+      DCHECK(pAnnot);
     }
 
     return pAnnot;
diff --git a/fpdfsdk/cpdfsdk_filewriteadapter.cpp b/fpdfsdk/cpdfsdk_filewriteadapter.cpp
index 2583e68..f0cbacf 100644
--- a/fpdfsdk/cpdfsdk_filewriteadapter.cpp
+++ b/fpdfsdk/cpdfsdk_filewriteadapter.cpp
@@ -6,9 +6,11 @@
 
 #include "fpdfsdk/cpdfsdk_filewriteadapter.h"
 
+#include "third_party/base/check.h"
+
 CPDFSDK_FileWriteAdapter::CPDFSDK_FileWriteAdapter(FPDF_FILEWRITE* file_write)
     : file_write_(file_write) {
-  ASSERT(file_write_);
+  DCHECK(file_write_);
 }
 
 CPDFSDK_FileWriteAdapter::~CPDFSDK_FileWriteAdapter() = default;
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index 077921b..c284f86 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -25,6 +25,7 @@
 #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h"
 #include "fpdfsdk/formfiller/cffl_privatedata.h"
 #include "fxjs/ijs_runtime.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 FPDF_WIDESTRING AsFPDFWideString(ByteString* bsUTF16LE) {
@@ -42,7 +43,7 @@
     : m_pInfo(pFFinfo),
       m_pCPDFDoc(pDoc),
       m_pAnnotHandlerMgr(std::move(pHandlerMgr)) {
-  ASSERT(m_pCPDFDoc);
+  DCHECK(m_pCPDFDoc);
   m_pAnnotHandlerMgr->SetFormFillEnv(this);
 }
 
@@ -96,7 +97,7 @@
     return;
 
   auto* pPage = FPDFPageFromIPDFPage(pFormFiller->GetSDKAnnot()->GetPage());
-  ASSERT(pPage);
+  DCHECK(pPage);
 
   CFX_PointF ptA = pFormFiller->PWLtoFFL(CFX_PointF(rect.left, rect.bottom));
   CFX_PointF ptB = pFormFiller->PWLtoFFL(CFX_PointF(rect.right, rect.top));
diff --git a/fpdfsdk/cpdfsdk_helpers.cpp b/fpdfsdk/cpdfsdk_helpers.cpp
index ef02222..5c15a1c 100644
--- a/fpdfsdk/cpdfsdk_helpers.cpp
+++ b/fpdfsdk/cpdfsdk_helpers.cpp
@@ -19,6 +19,7 @@
 #include "core/fpdfdoc/cpdf_interactiveform.h"
 #include "core/fpdfdoc/cpdf_metadata.h"
 #include "fpdfsdk/cpdfsdk_formfillenvironment.h"
+#include "third_party/base/check.h"
 
 namespace {
 
@@ -52,7 +53,7 @@
                                                     void* buffer,
                                                     unsigned long buflen,
                                                     bool decode) {
-  ASSERT(stream);
+  DCHECK(stream);
   auto stream_acc = pdfium::MakeRetain<CPDF_StreamAcc>(stream);
 
   if (decode)
@@ -239,8 +240,8 @@
 bool GetQuadPointsAtIndex(const CPDF_Array* array,
                           size_t quad_index,
                           FS_QUADPOINTSF* quad_points) {
-  ASSERT(quad_points);
-  ASSERT(array);
+  DCHECK(quad_points);
+  DCHECK(array);
 
   if (!IsValidQuadPointsIndex(array, quad_index))
     return false;
diff --git a/fpdfsdk/cpdfsdk_interactiveform.cpp b/fpdfsdk/cpdfsdk_interactiveform.cpp
index c9e9475..36a2189 100644
--- a/fpdfsdk/cpdfsdk_interactiveform.cpp
+++ b/fpdfsdk/cpdfsdk_interactiveform.cpp
@@ -35,6 +35,7 @@
 #include "fpdfsdk/ipdfsdk_annothandler.h"
 #include "fxjs/ijs_event_context.h"
 #include "fxjs/ijs_runtime.h"
+#include "third_party/base/check.h"
 
 namespace {
 
@@ -157,7 +158,7 @@
   for (int i = 0, sz = m_pInteractiveForm->CountFields(sFieldName); i < sz;
        ++i) {
     CPDF_FormField* pFormField = m_pInteractiveForm->GetField(i, sFieldName);
-    ASSERT(pFormField);
+    DCHECK(pFormField);
     GetWidgets(pFormField, widgets);
   }
 }
@@ -167,7 +168,7 @@
     std::vector<ObservedPtr<CPDFSDK_Annot>>* widgets) const {
   for (int i = 0, sz = pField->CountControls(); i < sz; ++i) {
     CPDF_FormControl* pFormCtrl = pField->GetControl(i);
-    ASSERT(pFormCtrl);
+    DCHECK(pFormCtrl);
     CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl);
     if (pWidget)
       widgets->emplace_back(pWidget);
@@ -177,7 +178,7 @@
 int CPDFSDK_InteractiveForm::GetPageIndexByAnnotDict(
     CPDF_Document* pDocument,
     CPDF_Dictionary* pAnnotDict) const {
-  ASSERT(pAnnotDict);
+  DCHECK(pAnnotDict);
 
   for (int i = 0, sz = pDocument->GetPageCount(); i < sz; i++) {
     if (CPDF_Dictionary* pPageDict = pDocument->GetPageDictionary(i)) {
@@ -320,7 +321,7 @@
     Optional<WideString> sValue) {
   for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) {
     CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
-    ASSERT(pFormCtrl);
+    DCHECK(pFormCtrl);
     if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl))
       pWidget->ResetAppearance(sValue, true);
   }
@@ -330,7 +331,7 @@
   auto* formfiller = m_pFormFillEnv->GetInteractiveFormFiller();
   for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) {
     CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
-    ASSERT(pFormCtrl);
+    DCHECK(pFormCtrl);
 
     CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl);
     if (!pWidget)
@@ -382,7 +383,7 @@
 }
 
 bool CPDFSDK_InteractiveForm::DoAction_Hide(const CPDF_Action& action) {
-  ASSERT(action.GetDict());
+  DCHECK(action.GetDict());
   std::vector<CPDF_FormField*> fields =
       GetFieldFromObjects(action.GetAllFields());
   bool bHide = action.GetHideStatus();
@@ -391,7 +392,7 @@
   for (CPDF_FormField* pField : fields) {
     for (int i = 0, sz = pField->CountControls(); i < sz; ++i) {
       CPDF_FormControl* pControl = pField->GetControl(i);
-      ASSERT(pControl);
+      DCHECK(pControl);
 
       if (CPDFSDK_Widget* pWidget = GetWidget(pControl)) {
         uint32_t nFlags = pWidget->GetFlags();
@@ -493,7 +494,7 @@
 }
 
 void CPDFSDK_InteractiveForm::DoAction_ResetForm(const CPDF_Action& action) {
-  ASSERT(action.GetDict());
+  DCHECK(action.GetDict());
   const CPDF_Dictionary* pActionDict = action.GetDict();
   if (!pActionDict->KeyExist("Fields")) {
     m_pInteractiveForm->ResetForm(NotificationOption::kNotify);
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index d7f5cb5..4b6705d 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -20,6 +20,7 @@
 #include "fpdfsdk/cpdfsdk_formfillenvironment.h"
 #include "fpdfsdk/cpdfsdk_helpers.h"
 #include "fpdfsdk/cpdfsdk_interactiveform.h"
+#include "third_party/base/check.h"
 #include "third_party/base/ptr_util.h"
 #include "third_party/base/stl_util.h"
 
@@ -33,7 +34,7 @@
 CPDFSDK_PageView::CPDFSDK_PageView(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                                    IPDF_Page* page)
     : m_page(page), m_pFormFillEnv(pFormFillEnv) {
-  ASSERT(m_page);
+  DCHECK(m_page);
   CPDF_Page* pPDFPage = ToPDFPage(page);
   if (pPDFPage) {
     CPDFSDK_InteractiveForm* pForm = pFormFillEnv->GetInteractiveForm();
@@ -128,7 +129,7 @@
   CPDFSDK_AnnotHandlerMgr* pAnnotHandler = m_pFormFillEnv->GetAnnotHandlerMgr();
   std::unique_ptr<CPDFSDK_Annot> pNewAnnot =
       pAnnotHandler->NewXFAAnnot(pPDFAnnot, this);
-  ASSERT(pNewAnnot);
+  DCHECK(pNewAnnot);
   pSDKAnnot = pNewAnnot.get();
   // TODO(thestig): See if |m_SDKAnnotArray|, which takes ownership of
   // |pNewAnnot|, can hold std::unique_ptrs instead of raw pointers.
@@ -504,7 +505,7 @@
     while (CXFA_FFWidget* pXFAAnnot = pWidgetHandler->MoveToNext()) {
       std::unique_ptr<CPDFSDK_Annot> pNewAnnot =
           pAnnotHandlerMgr->NewXFAAnnot(pXFAAnnot, this);
-      ASSERT(pNewAnnot);
+      DCHECK(pNewAnnot);
       CPDFSDK_Annot* pAnnot = pNewAnnot.get();
       m_SDKAnnotArray.push_back(pNewAnnot.release());
       pAnnotHandlerMgr->Annot_OnLoad(pAnnot);
@@ -515,7 +516,7 @@
 #endif  // PDF_ENABLE_XFA
 
   CPDF_Page* pPage = GetPDFPage();
-  ASSERT(pPage);
+  DCHECK(pPage);
   bool bUpdateAP = CPDF_InteractiveForm::IsUpdateAPEnabled();
   // Disable the default AP construction.
   CPDF_InteractiveForm::SetUpdateAP(false);
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 78a010c..e841971 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -33,6 +33,7 @@
 #include "fpdfsdk/cpdfsdk_interactiveform.h"
 #include "fpdfsdk/cpdfsdk_pageview.h"
 #include "fpdfsdk/pwl/cpwl_edit.h"
+#include "third_party/base/check.h"
 #include "third_party/base/notreached.h"
 
 #ifdef PDF_ENABLE_XFA
@@ -624,13 +625,13 @@
 
 Optional<WideString> CPDFSDK_Widget::OnFormat() {
   CPDF_FormField* pFormField = GetFormField();
-  ASSERT(pFormField);
+  DCHECK(pFormField);
   return m_pInteractiveForm->OnFormat(pFormField);
 }
 
 void CPDFSDK_Widget::ResetFieldAppearance() {
   CPDF_FormField* pFormField = GetFormField();
-  ASSERT(pFormField);
+  DCHECK(pFormField);
   m_pInteractiveForm->ResetFieldAppearance(pFormField, pdfium::nullopt);
 }
 
@@ -658,7 +659,7 @@
 
 void CPDFSDK_Widget::UpdateField() {
   CPDF_FormField* pFormField = GetFormField();
-  ASSERT(pFormField);
+  DCHECK(pFormField);
   m_pInteractiveForm->UpdateField(pFormField);
 }
 
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index 63d0edf..a9cd4da 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -19,6 +19,7 @@
 #include "fpdfsdk/cpdfsdk_pageview.h"
 #include "fpdfsdk/cpdfsdk_widget.h"
 #include "fpdfsdk/formfiller/cffl_formfiller.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler() = default;
@@ -70,7 +71,7 @@
 
 void CPDFSDK_WidgetHandler::ReleaseAnnot(
     std::unique_ptr<CPDFSDK_Annot> pAnnot) {
-  ASSERT(pAnnot);
+  DCHECK(pAnnot);
   m_pFormFiller->OnDelete(pAnnot.get());
 
   std::unique_ptr<CPDFSDK_Widget> pWidget(ToCPDFSDKWidget(pAnnot.release()));
@@ -299,14 +300,14 @@
 bool CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView,
                                     CPDFSDK_Annot* pAnnot,
                                     const CFX_PointF& point) {
-  ASSERT(pPageView);
-  ASSERT(pAnnot);
+  DCHECK(pPageView);
+  DCHECK(pAnnot);
   return GetViewBBox(pPageView, pAnnot).Contains(point);
 }
 
 bool CPDFSDK_WidgetHandler::IsFocusableAnnot(
     const CPDF_Annot::Subtype& annot_type) const {
-  ASSERT(annot_type == CPDF_Annot::Subtype::WIDGET);
+  DCHECK(annot_type == CPDF_Annot::Subtype::WIDGET);
 
   return pdfium::Contains(m_pFormFillEnv->GetFocusableAnnotSubtypes(),
                           annot_type);
diff --git a/fpdfsdk/formfiller/cffl_button.cpp b/fpdfsdk/formfiller/cffl_button.cpp
index fcc6154..233bf49 100644
--- a/fpdfsdk/formfiller/cffl_button.cpp
+++ b/fpdfsdk/formfiller/cffl_button.cpp
@@ -7,6 +7,7 @@
 #include "fpdfsdk/formfiller/cffl_button.h"
 
 #include "core/fpdfdoc/cpdf_formcontrol.h"
+#include "third_party/base/check.h"
 
 CFFL_Button::CFFL_Button(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                          CPDFSDK_Widget* pWidget)
@@ -25,7 +26,7 @@
   m_bMouseIn = false;
   InvalidateRect(GetViewBBox(pPageView));
   m_pTimer.reset();
-  ASSERT(m_pWidget);
+  DCHECK(m_pWidget);
 }
 
 bool CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView,
@@ -63,7 +64,7 @@
                          CPDFSDK_Annot* pAnnot,
                          CFX_RenderDevice* pDevice,
                          const CFX_Matrix& mtUser2Device) {
-  ASSERT(pPageView);
+  DCHECK(pPageView);
   CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot);
   CPDF_FormControl* pCtrl = pWidget->GetFormControl();
   if (pCtrl->GetHighlightingMode() != CPDF_FormControl::Push) {
diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp
index c8f1148..4b0c6ef 100644
--- a/fpdfsdk/formfiller/cffl_checkbox.cpp
+++ b/fpdfsdk/formfiller/cffl_checkbox.cpp
@@ -14,6 +14,7 @@
 #include "fpdfsdk/formfiller/cffl_formfiller.h"
 #include "fpdfsdk/pwl/cpwl_special_button.h"
 #include "public/fpdf_fwlevent.h"
+#include "third_party/base/check.h"
 
 CFFL_CheckBox::CFFL_CheckBox(CPDFSDK_FormFillEnvironment* pApp,
                              CPDFSDK_Widget* pWidget)
@@ -46,7 +47,7 @@
     case FWL_VKEY_Return:
     case FWL_VKEY_Space: {
       CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
-      ASSERT(pPageView);
+      DCHECK(pPageView);
 
       ObservedPtr<CPDFSDK_Annot> pObserved(m_pWidget.Get());
       if (m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp(
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index d00252c..343ff03 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -15,11 +15,12 @@
 #include "fpdfsdk/cpdfsdk_pageview.h"
 #include "fpdfsdk/cpdfsdk_widget.h"
 #include "fpdfsdk/formfiller/cffl_privatedata.h"
+#include "third_party/base/check.h"
 
 CFFL_FormFiller::CFFL_FormFiller(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                                  CPDFSDK_Widget* pWidget)
     : m_pFormFillEnv(pFormFillEnv), m_pWidget(pWidget) {
-  ASSERT(m_pFormFillEnv);
+  DCHECK(m_pFormFillEnv);
 }
 
 CFFL_FormFiller::~CFFL_FormFiller() {
@@ -82,7 +83,7 @@
 
 void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView* pPageView) {
   m_pTimer.reset();
-  ASSERT(m_pWidget);
+  DCHECK(m_pWidget);
 }
 
 bool CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView,
@@ -344,7 +345,7 @@
 
 CPWL_Wnd* CFFL_FormFiller::GetPWLWindow(CPDFSDK_PageView* pPageView,
                                         bool bNew) {
-  ASSERT(pPageView);
+  DCHECK(pPageView);
   auto it = m_Maps.find(pPageView);
   if (it == m_Maps.end()) {
     if (!bNew)
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index e26fdfe..0794055 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -24,6 +24,7 @@
 #include "fpdfsdk/formfiller/cffl_radiobutton.h"
 #include "fpdfsdk/formfiller/cffl_textfield.h"
 #include "public/fpdf_fwlevent.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 CFFL_InteractiveFormFiller::CFFL_InteractiveFormFiller(
@@ -43,7 +44,7 @@
   if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot))
     return pFormFiller->GetViewBBox(pPageView);
 
-  ASSERT(pPageView);
+  DCHECK(pPageView);
 
   CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
   CFX_FloatRect rcWin = pPDFAnnot->GetRect();
@@ -58,7 +59,7 @@
                                         CPDFSDK_Annot* pAnnot,
                                         CFX_RenderDevice* pDevice,
                                         const CFX_Matrix& mtUser2Device) {
-  ASSERT(pPageView);
+  DCHECK(pPageView);
   CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot);
   if (!IsVisible(pWidget))
     return;
@@ -97,7 +98,7 @@
     CPDFSDK_PageView* pPageView,
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlag) {
-  ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   if (!m_bNotifying) {
     CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
     if (pWidget->GetAAction(CPDF_AAction::kCursorEnter).GetDict()) {
@@ -105,7 +106,7 @@
 
       uint32_t nValueAge = pWidget->GetValueAge();
       pWidget->ClearAppModified();
-      ASSERT(pPageView);
+      DCHECK(pPageView);
 
       CPDFSDK_FieldAction fa;
       fa.bModifier = CPWL_Wnd::IsCTRLKeyDown(nFlag);
@@ -130,7 +131,7 @@
 void CFFL_InteractiveFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView,
                                              ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              uint32_t nFlag) {
-  ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   if (!m_bNotifying) {
     CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
     if (pWidget->GetAAction(CPDF_AAction::kCursorExit).GetDict()) {
@@ -138,7 +139,7 @@
 
       uint32_t nValueAge = pWidget->GetValueAge();
       pWidget->ClearAppModified();
-      ASSERT(pPageView);
+      DCHECK(pPageView);
 
       CPDFSDK_FieldAction fa;
       fa.bModifier = CPWL_Wnd::IsCTRLKeyDown(nFlag);
@@ -165,7 +166,7 @@
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
-  ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   if (!m_bNotifying) {
     CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
     if (Annot_HitTest(pPageView, pAnnot->Get(), point) &&
@@ -174,7 +175,7 @@
 
       uint32_t nValueAge = pWidget->GetValueAge();
       pWidget->ClearAppModified();
-      ASSERT(pPageView);
+      DCHECK(pPageView);
 
       CPDFSDK_FieldAction fa;
       fa.bModifier = CPWL_Wnd::IsCTRLKeyDown(nFlags);
@@ -204,7 +205,7 @@
                                              ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              uint32_t nFlags,
                                              const CFX_PointF& point) {
-  ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
 
   bool bSetFocus;
@@ -252,7 +253,7 @@
 
   uint32_t nAge = pWidget->GetAppearanceAge();
   uint32_t nValueAge = pWidget->GetValueAge();
-  ASSERT(pPageView);
+  DCHECK(pPageView);
 
   CPDFSDK_FieldAction fa;
   fa.bModifier = CPWL_Wnd::IsCTRLKeyDown(nFlag);
@@ -274,7 +275,7 @@
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     int index,
     bool selected) {
-  ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
 
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get());
   return pFormFiller && pFormFiller->SetIndexSelected(index, selected);
@@ -283,7 +284,7 @@
 bool CFFL_InteractiveFormFiller::IsIndexSelected(
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     int index) {
-  ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
 
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get());
   return pFormFiller && pFormFiller->IsIndexSelected(index);
@@ -294,7 +295,7 @@
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
-  ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get());
   return pFormFiller && pFormFiller->OnLButtonDblClk(pPageView, nFlags, point);
 }
@@ -303,7 +304,7 @@
                                              ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              uint32_t nFlags,
                                              const CFX_PointF& point) {
-  ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CFFL_FormFiller* pFormFiller = GetOrCreateFormFiller(pAnnot->Get());
   return pFormFiller && pFormFiller->OnMouseMove(pPageView, nFlags, point);
 }
@@ -314,7 +315,7 @@
     uint32_t nFlags,
     const CFX_PointF& point,
     const CFX_Vector& delta) {
-  ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get());
   return pFormFiller &&
          pFormFiller->OnMouseWheel(pPageView, nFlags, point, delta);
@@ -325,7 +326,7 @@
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
-  ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get());
   return pFormFiller && pFormFiller->OnRButtonDown(pPageView, nFlags, point);
 }
@@ -334,7 +335,7 @@
                                              ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              uint32_t nFlags,
                                              const CFX_PointF& point) {
-  ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get());
   return pFormFiller && pFormFiller->OnRButtonUp(pPageView, nFlags, point);
 }
@@ -342,7 +343,7 @@
 bool CFFL_InteractiveFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot,
                                            uint32_t nKeyCode,
                                            uint32_t nFlags) {
-  ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
 
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot);
   return pFormFiller && pFormFiller->OnKeyDown(nKeyCode, nFlags);
@@ -351,7 +352,7 @@
 bool CFFL_InteractiveFormFiller::OnChar(CPDFSDK_Annot* pAnnot,
                                         uint32_t nChar,
                                         uint32_t nFlags) {
-  ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   if (nChar == FWL_VKEY_Tab)
     return true;
 
@@ -364,7 +365,7 @@
   if (!pAnnot->HasObservable())
     return false;
 
-  ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   if (!m_bNotifying) {
     CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
     if (pWidget->GetAAction(CPDF_AAction::kGetFocus).GetDict()) {
@@ -378,7 +379,7 @@
         return false;
 
       CPDFSDK_PageView* pPageView = (*pAnnot)->GetPageView();
-      ASSERT(pPageView);
+      DCHECK(pPageView);
 
       CPDFSDK_FieldAction fa;
       fa.bModifier = CPWL_Wnd::IsCTRLKeyDown(nFlag);
@@ -409,7 +410,7 @@
   if (!pAnnot->HasObservable())
     return false;
 
-  ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get());
   if (!pFormFiller)
     return true;
@@ -429,7 +430,7 @@
   pWidget->ClearAppModified();
 
   CPDFSDK_PageView* pPageView = pWidget->GetPageView();
-  ASSERT(pPageView);
+  DCHECK(pPageView);
 
   CPDFSDK_FieldAction fa;
   fa.bModifier = CPWL_Wnd::IsCTRLKeyDown(nFlag);
@@ -510,20 +511,20 @@
 }
 
 WideString CFFL_InteractiveFormFiller::GetText(CPDFSDK_Annot* pAnnot) {
-  ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot);
   return pFormFiller ? pFormFiller->GetText() : WideString();
 }
 
 WideString CFFL_InteractiveFormFiller::GetSelectedText(CPDFSDK_Annot* pAnnot) {
-  ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot);
   return pFormFiller ? pFormFiller->GetSelectedText() : WideString();
 }
 
 void CFFL_InteractiveFormFiller::ReplaceSelection(CPDFSDK_Annot* pAnnot,
                                                   const WideString& text) {
-  ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot);
   if (!pFormFiller)
     return;
@@ -532,31 +533,31 @@
 }
 
 bool CFFL_InteractiveFormFiller::SelectAllText(CPDFSDK_Annot* pAnnot) {
-  ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot);
   return pAnnot && pFormFiller->SelectAllText();
 }
 
 bool CFFL_InteractiveFormFiller::CanUndo(CPDFSDK_Annot* pAnnot) {
-  ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot);
   return pFormFiller && pFormFiller->CanUndo();
 }
 
 bool CFFL_InteractiveFormFiller::CanRedo(CPDFSDK_Annot* pAnnot) {
-  ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot);
   return pFormFiller && pFormFiller->CanRedo();
 }
 
 bool CFFL_InteractiveFormFiller::Undo(CPDFSDK_Annot* pAnnot) {
-  ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot);
   return pFormFiller && pFormFiller->Undo();
 }
 
 bool CFFL_InteractiveFormFiller::Redo(CPDFSDK_Annot* pAnnot) {
-  ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+  DCHECK(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot);
   return pFormFiller && pFormFiller->Redo();
 }
@@ -641,7 +642,7 @@
   if (!pWidget->GetAAction(CPDF_AAction::kKeyStroke).GetDict())
     return true;
 
-  ASSERT(pPageView);
+  DCHECK(pPageView);
   m_bNotifying = true;
   pWidget->ClearAppModified();
 
@@ -673,7 +674,7 @@
   if (!pWidget->GetAAction(CPDF_AAction::kValidate).GetDict())
     return true;
 
-  ASSERT(pPageView);
+  DCHECK(pPageView);
   m_bNotifying = true;
   pWidget->ClearAppModified();
 
@@ -716,7 +717,7 @@
     return;
 
   CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
-  ASSERT(pWidget);
+  DCHECK(pWidget);
   CPDFSDK_InteractiveForm* pForm =
       pPageView->GetFormFillEnv()->GetInteractiveForm();
 
@@ -874,7 +875,7 @@
   auto* pPrivateData = static_cast<const CFFL_PrivateData*>(pAttached);
   CPDFSDK_PageView* pPageView = pPrivateData->GetPageView();
   ObservedPtr<CPDFSDK_Widget> pWidget(pPrivateData->GetWidget());
-  ASSERT(pWidget);
+  DCHECK(pWidget);
 
   CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget.Get());
 
@@ -949,7 +950,7 @@
     uint32_t nFlag) {
 #ifdef PDF_ENABLE_XFA
   auto* pData = static_cast<const CFFL_PrivateData*>(pAttached);
-  ASSERT(pData->GetWidget());
+  DCHECK(pData->GetWidget());
 
   ObservedPtr<CPDFSDK_Annot> pObserved(pData->GetWidget());
   return OnPreOpen(&pObserved, pData->GetPageView(), nFlag) || !pObserved;
@@ -963,7 +964,7 @@
     uint32_t nFlag) {
 #ifdef PDF_ENABLE_XFA
   auto* pData = static_cast<const CFFL_PrivateData*>(pAttached);
-  ASSERT(pData->GetWidget());
+  DCHECK(pData->GetWidget());
 
   ObservedPtr<CPDFSDK_Annot> pObserved(pData->GetWidget());
   return OnPostOpen(&pObserved, pData->GetPageView(), nFlag) || !pObserved;
diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp
index 0d167b4..ff0cce9 100644
--- a/fpdfsdk/formfiller/cffl_radiobutton.cpp
+++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp
@@ -14,6 +14,7 @@
 #include "fpdfsdk/formfiller/cffl_formfiller.h"
 #include "fpdfsdk/pwl/cpwl_special_button.h"
 #include "public/fpdf_fwlevent.h"
+#include "third_party/base/check.h"
 
 CFFL_RadioButton::CFFL_RadioButton(CPDFSDK_FormFillEnvironment* pApp,
                                    CPDFSDK_Widget* pWidget)
@@ -47,7 +48,7 @@
     case FWL_VKEY_Return:
     case FWL_VKEY_Space: {
       CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
-      ASSERT(pPageView);
+      DCHECK(pPageView);
 
       ObservedPtr<CPDFSDK_Annot> pObserved(m_pWidget.Get());
       if (m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp(
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index fd1c719..13bd411 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -14,6 +14,7 @@
 #include "fpdfsdk/cpdfsdk_widget.h"
 #include "fpdfsdk/pwl/cpwl_edit.h"
 #include "public/fpdf_fwlevent.h"
+#include "third_party/base/check.h"
 
 namespace {
 
@@ -112,7 +113,7 @@
         break;
 
       CPDFSDK_PageView* pPageView = GetCurPageView();
-      ASSERT(pPageView);
+      DCHECK(pPageView);
       m_bValid = !m_bValid;
       m_pFormFillEnv->Invalidate(pAnnot->GetPage(),
                                  pAnnot->GetRect().GetOuterRect());
@@ -131,7 +132,7 @@
     }
     case FWL_VKEY_Escape: {
       CPDFSDK_PageView* pPageView = GetCurPageView();
-      ASSERT(pPageView);
+      DCHECK(pPageView);
       EscapeFiller(pPageView, true);
       return true;
     }
diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
index eee3567..5b40c46 100644
--- a/fpdfsdk/fpdf_annot.cpp
+++ b/fpdfsdk/fpdf_annot.cpp
@@ -33,6 +33,7 @@
 #include "fpdfsdk/cpdfsdk_formfillenvironment.h"
 #include "fpdfsdk/cpdfsdk_helpers.h"
 #include "fpdfsdk/cpdfsdk_interactiveform.h"
+#include "third_party/base/check.h"
 #include "third_party/base/ptr_util.h"
 #include "third_party/base/stl_util.h"
 
@@ -164,8 +165,8 @@
 }
 
 void UpdateContentStream(CPDF_Form* pForm, CPDF_Stream* pStream) {
-  ASSERT(pForm);
-  ASSERT(pStream);
+  DCHECK(pForm);
+  DCHECK(pStream);
 
   CPDF_PageContentGenerator generator(pForm);
   std::ostringstream buf;
@@ -176,9 +177,9 @@
 void SetQuadPointsAtIndex(CPDF_Array* array,
                           size_t quad_index,
                           const FS_QUADPOINTSF* quad_points) {
-  ASSERT(array);
-  ASSERT(quad_points);
-  ASSERT(IsValidQuadPointsIndex(array, quad_index));
+  DCHECK(array);
+  DCHECK(quad_points);
+  DCHECK(IsValidQuadPointsIndex(array, quad_index));
 
   size_t nIndex = quad_index * 8;
   array->SetNewAt<CPDF_Number>(nIndex, quad_points->x1);
@@ -192,8 +193,8 @@
 }
 
 void AppendQuadPoints(CPDF_Array* array, const FS_QUADPOINTSF* quad_points) {
-  ASSERT(quad_points);
-  ASSERT(array);
+  DCHECK(quad_points);
+  DCHECK(array);
 
   array->AppendNew<CPDF_Number>(quad_points->x1);
   array->AppendNew<CPDF_Number>(quad_points->y1);
@@ -206,7 +207,7 @@
 }
 
 void UpdateBBox(CPDF_Dictionary* annot_dict) {
-  ASSERT(annot_dict);
+  DCHECK(annot_dict);
   // Update BBox entry in appearance stream based on the bounding rectangle
   // of the annotation's quadpoints.
   CPDF_Stream* pStream =
diff --git a/fpdfsdk/fpdf_doc.cpp b/fpdfsdk/fpdf_doc.cpp
index 94a1d04..83d9a4a 100644
--- a/fpdfsdk/fpdf_doc.cpp
+++ b/fpdfsdk/fpdf_doc.cpp
@@ -27,6 +27,7 @@
 #include "core/fpdfdoc/cpdf_pagelabel.h"
 #include "fpdfsdk/cpdfsdk_helpers.h"
 #include "public/fpdf_formfill.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 namespace {
@@ -248,7 +249,7 @@
 
   CPDF_Dest destination(CPDFArrayFromFPDFDest(dest));
   unsigned long nParams = destination.GetNumParams();
-  ASSERT(nParams <= 4);
+  DCHECK(nParams <= 4);
   *pNumParams = nParams;
   for (unsigned long i = 0; i < nParams; ++i)
     pParams[i] = destination.GetParam(i);
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index 099bc00..e64c0b3 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -32,6 +32,7 @@
 #include "testing/utils/file_util.h"
 #include "testing/utils/hash.h"
 #include "testing/utils/path_service.h"
+#include "third_party/base/check.h"
 
 using pdfium::kHelloWorldChecksum;
 
@@ -258,7 +259,7 @@
   size_t file_length = 0;
   std::unique_ptr<char, pdfium::FreeDeleter> font_data =
       GetFileContents(font_path.c_str(), &file_length);
-  ASSERT(font_data);
+  DCHECK(font_data);
 
   ScopedFPDFFont font(FPDFText_LoadFont(
       document(), reinterpret_cast<const uint8_t*>(font_data.get()),
diff --git a/fpdfsdk/fpdf_editpath_embeddertest.cpp b/fpdfsdk/fpdf_editpath_embeddertest.cpp
index 2a8fb6a..51b4d58 100644
--- a/fpdfsdk/fpdf_editpath_embeddertest.cpp
+++ b/fpdfsdk/fpdf_editpath_embeddertest.cpp
@@ -6,6 +6,7 @@
 #include "public/fpdf_edit.h"
 #include "testing/embedder_test.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/check.h"
 
 class FPDFEditPathEmbedderTest : public EmbedderTest {};
 
@@ -33,7 +34,7 @@
 
   ASSERT_TRUE(OpenSavedDocument());
   page = LoadSavedPage(0);
-  ASSERT(page);
+  DCHECK(page);
 
   for (size_t i = 0; i < kObjectCount; ++i) {
     FPDF_PAGEOBJECT path = FPDFPage_GetObject(page, i);
diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
index 4a4630e..5fbec35 100644
--- a/fpdfsdk/fpdf_edittext.cpp
+++ b/fpdfsdk/fpdf_edittext.cpp
@@ -26,6 +26,7 @@
 #include "core/fxge/fx_font.h"
 #include "fpdfsdk/cpdfsdk_helpers.h"
 #include "public/fpdf_edit.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 // These checks are here because core/ and public/ cannot depend on each other.
@@ -132,7 +133,7 @@
     "end\n";
 
 void AddCharcode(std::ostringstream* pBuffer, uint32_t number) {
-  ASSERT(number <= 0xFFFF);
+  DCHECK(number <= 0xFFFF);
   *pBuffer << "<";
   char ans[4];
   FXSYS_IntToFourHexChars(number, ans);
@@ -203,7 +204,7 @@
         unicodes.push_back(iter->second);
         next_it = std::next(iter);
       }
-      ASSERT(iter->first - firstCharcode + 1 == unicodes.size());
+      DCHECK(iter->first - firstCharcode + 1 == unicodes.size());
       map_range_vector[std::make_pair(firstCharcode, iter->first)] = unicodes;
       continue;
     }
diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp
index 73e04ee..633ff9e 100644
--- a/fpdfsdk/fpdf_formfill_embeddertest.cpp
+++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp
@@ -19,6 +19,7 @@
 #include "testing/embedder_test_timer_handling_delegate.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/check.h"
 #include "third_party/base/check_op.h"
 #include "third_party/base/stl_util.h"
 
@@ -110,7 +111,7 @@
 
   // Uses the mouse to navigate to text field and select text.
   void SelectTextWithMouse(const CFX_PointF& start, const CFX_PointF& end) {
-    ASSERT(start.y == end.y);
+    DCHECK(start.y == end.y);
 
     // Navigate to starting position and click mouse.
     FORM_OnMouseMove(form_handle(), page_, 0, start.x, start.y);
@@ -238,14 +239,14 @@
   }
 
   static CFX_PointF CharLimitFormAtX(float x) {
-    ASSERT(x >= kFormBeginX);
-    ASSERT(x <= kFormEndX);
+    DCHECK(x >= kFormBeginX);
+    DCHECK(x <= kFormEndX);
     return CFX_PointF(x, kCharLimitFormY);
   }
 
   static CFX_PointF RegularFormAtX(float x) {
-    ASSERT(x >= kFormBeginX);
-    ASSERT(x <= kFormEndX);
+    DCHECK(x >= kFormBeginX);
+    DCHECK(x <= kFormEndX);
     return CFX_PointF(x, kRegularFormY);
   }
 
@@ -282,14 +283,14 @@
   }
 
   void SelectEditableFormOption(int item_index) {
-    ASSERT(item_index >= 0);
-    ASSERT(item_index < 3);
+    DCHECK(item_index >= 0);
+    DCHECK(item_index < 3);
     SelectOption(item_index, EditableFormDropDown());
   }
 
   void SelectNonEditableFormOption(int item_index) {
-    ASSERT(item_index >= 0);
-    ASSERT(item_index < 26);
+    DCHECK(item_index >= 0);
+    DCHECK(item_index < 26);
     SelectOption(item_index, NonEditableFormDropDown());
   }
 
@@ -332,14 +333,14 @@
   }
 
   static CFX_PointF EditableFormAtX(float x) {
-    ASSERT(x >= kFormBeginX);
-    ASSERT(x <= kFormEndX);
+    DCHECK(x >= kFormBeginX);
+    DCHECK(x <= kFormEndX);
     return CFX_PointF(x, kEditableFormY);
   }
 
   static CFX_PointF NonEditableFormAtX(float x) {
-    ASSERT(x >= kFormBeginX);
-    ASSERT(x <= kFormEndX);
+    DCHECK(x >= kFormBeginX);
+    DCHECK(x <= kFormEndX);
     return CFX_PointF(x, kNonEditableFormY);
   }
 
@@ -428,8 +429,8 @@
   void ClickOnSingleSelectFormOption(int item_index) {
     // Only the first two indices are visible so can only click on those
     // without scrolling.
-    ASSERT(item_index >= 0);
-    ASSERT(item_index < 2);
+    DCHECK(item_index >= 0);
+    DCHECK(item_index < 2);
     if (item_index == 0) {
       ClickOnFormFieldAtPoint(SingleSelectFirstVisibleOption());
     } else {
@@ -440,8 +441,8 @@
   void ClickOnMultiSelectFormOption(int item_index) {
     // Only the first two indices are visible so can only click on those
     // without scrolling.
-    ASSERT(item_index >= 0);
-    ASSERT(item_index < 2);
+    DCHECK(item_index >= 0);
+    DCHECK(item_index < 2);
     if (item_index == 0) {
       ClickOnFormFieldAtPoint(MultiSelectFirstVisibleOption());
     } else {
@@ -452,8 +453,8 @@
   void ClickOnMultiSelectMultipleValuesFormOption(int item_index) {
     // Only two indices are visible so can only click on those
     // without scrolling.
-    ASSERT(item_index >= 0);
-    ASSERT(item_index < 2);
+    DCHECK(item_index >= 0);
+    DCHECK(item_index < 2);
     if (item_index == 0) {
       ClickOnFormFieldAtPoint(MultiSelectMultipleValuesFirstVisibleOption());
     } else {
@@ -464,8 +465,8 @@
   void ClickOnSingleSelectLastSelectedFormOption(int item_index) {
     // Only two indices are visible so can only click on those
     // without scrolling.
-    ASSERT(item_index >= 0);
-    ASSERT(item_index < 2);
+    DCHECK(item_index >= 0);
+    DCHECK(item_index < 2);
     if (item_index == 0) {
       ClickOnFormFieldAtPoint(SingleSelectLastSelectedFirstVisibleOption());
     } else {
diff --git a/fpdfsdk/fpdf_ppo.cpp b/fpdfsdk/fpdf_ppo.cpp
index 43a45e2..489d610 100644
--- a/fpdfsdk/fpdf_ppo.cpp
+++ b/fpdfsdk/fpdf_ppo.cpp
@@ -31,6 +31,7 @@
 #include "core/fxcrt/unowned_ptr.h"
 #include "fpdfsdk/cpdfsdk_helpers.h"
 #include "public/cpp/fpdf_scopers.h"
+#include "third_party/base/check.h"
 
 namespace {
 
@@ -86,10 +87,10 @@
       m_nPagesOnXAxis(nPagesOnXAxis),
       m_nPagesOnYAxis(nPagesOnYAxis),
       m_nPagesPerSheet(nPagesOnXAxis * nPagesOnYAxis) {
-  ASSERT(m_nPagesOnXAxis > 0);
-  ASSERT(m_nPagesOnYAxis > 0);
-  ASSERT(m_destPageSize.width > 0);
-  ASSERT(m_destPageSize.height > 0);
+  DCHECK(m_nPagesOnXAxis > 0);
+  DCHECK(m_nPagesOnYAxis > 0);
+  DCHECK(m_destPageSize.width > 0);
+  DCHECK(m_destPageSize.height > 0);
 
   m_subPageSize.width = m_destPageSize.width / m_nPagesOnXAxis;
   m_subPageSize.height = m_destPageSize.height / m_nPagesOnYAxis;
@@ -310,8 +311,8 @@
 CPDF_PageOrganizer::~CPDF_PageOrganizer() = default;
 
 bool CPDF_PageOrganizer::Init() {
-  ASSERT(m_pDestDoc);
-  ASSERT(m_pSrcDoc);
+  DCHECK(m_pDestDoc);
+  DCHECK(m_pSrcDoc);
 
   CPDF_Dictionary* pNewRoot = dest()->GetRoot();
   if (!pNewRoot)
@@ -658,7 +659,7 @@
 
 ByteString CPDF_NPageToOneExporter::MakeXObjectFromPage(
     const CPDF_Dictionary* pSrcPageDict) {
-  ASSERT(pSrcPageDict);
+  DCHECK(pSrcPageDict);
 
   const CPDF_Object* pSrcContentObj =
       pSrcPageDict->GetDirectObjectFor(pdfium::page_object::kContents);
@@ -711,7 +712,7 @@
 
 void CPDF_NPageToOneExporter::FinishPage(CPDF_Dictionary* pDestPageDict,
                                          const ByteString& bsContent) {
-  ASSERT(pDestPageDict);
+  DCHECK(pDestPageDict);
 
   CPDF_Dictionary* pRes =
       pDestPageDict->GetDictFor(pdfium::page_object::kResources);
@@ -777,7 +778,7 @@
     return nullptr;
 
   CPDF_Document* pDestDoc = CPDFDocumentFromFPDFDocument(output_doc.get());
-  ASSERT(pDestDoc);
+  DCHECK(pDestDoc);
 
   std::vector<uint32_t> page_numbers = GetPageNumbers(*pSrcDoc, ByteString());
   if (page_numbers.empty())
diff --git a/fpdfsdk/fpdf_text.cpp b/fpdfsdk/fpdf_text.cpp
index 915abb9..7bdf296 100644
--- a/fpdfsdk/fpdf_text.cpp
+++ b/fpdfsdk/fpdf_text.cpp
@@ -19,6 +19,7 @@
 #include "core/fpdftext/cpdf_textpage.h"
 #include "core/fpdftext/cpdf_textpagefind.h"
 #include "fpdfsdk/cpdfsdk_helpers.h"
+#include "third_party/base/check.h"
 #include "third_party/base/numerics/safe_conversions.h"
 #include "third_party/base/stl_util.h"
 
@@ -311,7 +312,7 @@
   size_t byte_str_len = byte_str.GetLength();
   int ret_count = byte_str_len / kBytesPerCharacter;
 
-  ASSERT(ret_count <= char_count + 1);  // +1 to account for the NUL terminator.
+  DCHECK(ret_count <= char_count + 1);  // +1 to account for the NUL terminator.
   memcpy(result, byte_str.c_str(), byte_str_len);
   return ret_count;
 }
diff --git a/fpdfsdk/fpdf_view_embeddertest.cpp b/fpdfsdk/fpdf_view_embeddertest.cpp
index f755162..a47145e 100644
--- a/fpdfsdk/fpdf_view_embeddertest.cpp
+++ b/fpdfsdk/fpdf_view_embeddertest.cpp
@@ -22,6 +22,7 @@
 #include "testing/utils/file_util.h"
 #include "testing/utils/hash.h"
 #include "testing/utils/path_service.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 using pdfium::kManyRectanglesChecksum;
@@ -348,7 +349,7 @@
   size_t file_length = 0;
   std::unique_ptr<char, pdfium::FreeDeleter> file_contents =
       GetFileContents(file_path.c_str(), &file_length);
-  ASSERT(file_contents);
+  DCHECK(file_contents);
   ScopedFPDFDocument doc(
       FPDF_LoadMemDocument64(file_contents.get(), file_length, nullptr));
   ASSERT_TRUE(doc);
@@ -1230,7 +1231,7 @@
     size_t file_length = 0;
     std::unique_ptr<char, pdfium::FreeDeleter> file_contents =
         GetFileContents(file_path.c_str(), &file_length);
-    ASSERT(file_contents);
+    DCHECK(file_contents);
     ScopedFPDFDocument doc(
         FPDF_LoadMemDocument(file_contents.get(), file_length, ""));
     ASSERT_TRUE(doc);
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index 469f6d6..abeae95 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -25,6 +25,7 @@
 #include "fxjs/cjs_runtime.h"
 #include "fxjs/ijs_runtime.h"
 #include "public/fpdf_formfill.h"
+#include "third_party/base/check.h"
 #include "third_party/base/notreached.h"
 #include "third_party/base/stl_util.h"
 #include "v8/include/cppgc/allocation.h"
@@ -101,7 +102,7 @@
     : m_pPDFDoc(pPDFDoc),
       m_pDocEnv(std::make_unique<CPDFXFA_DocEnvironment>(this)),
       m_pGCHeap(FXGC_CreateHeap()) {
-  ASSERT(m_pPDFDoc);
+  DCHECK(m_pPDFDoc);
 
   // There might not be a heap when JS not initialized.
   if (m_pGCHeap) {
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index e6a599c..c6d9513 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -21,6 +21,7 @@
 #include "fpdfsdk/cpdfsdk_pageview.h"
 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
+#include "third_party/base/check.h"
 #include "xfa/fxfa/cxfa_ffdocview.h"
 #include "xfa/fxfa/cxfa_ffwidget.h"
 #include "xfa/fxfa/cxfa_ffwidgethandler.h"
@@ -45,7 +46,7 @@
 
 CPDFXFA_DocEnvironment::CPDFXFA_DocEnvironment(CPDFXFA_Context* pContext)
     : m_pContext(pContext) {
-  ASSERT(m_pContext);
+  DCHECK(m_pContext);
 }
 
 CPDFXFA_DocEnvironment::~CPDFXFA_DocEnvironment() = default;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index 372d597..b7606be 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -14,6 +14,7 @@
 #include "fpdfsdk/cpdfsdk_pageview.h"
 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
 #include "fpdfsdk/fpdfxfa/cpdfxfa_widget.h"
+#include "third_party/base/check.h"
 #include "third_party/base/notreached.h"
 #include "xfa/fgas/graphics/cfgas_gegraphics.h"
 #include "xfa/fxfa/cxfa_ffdocview.h"
@@ -31,8 +32,8 @@
 
 CPDFXFA_Page::CPDFXFA_Page(CPDF_Document* pDocument, int page_index)
     : m_pDocument(pDocument), m_iPageIndex(page_index) {
-  ASSERT(m_pDocument->GetExtension());
-  ASSERT(m_iPageIndex >= 0);
+  DCHECK(m_pDocument->GetExtension());
+  DCHECK(m_iPageIndex >= 0);
 }
 
 CPDFXFA_Page::~CPDFXFA_Page() = default;
@@ -82,7 +83,7 @@
 }
 
 void CPDFXFA_Page::LoadPDFPageFromDict(CPDF_Dictionary* pPageDict) {
-  ASSERT(pPageDict);
+  DCHECK(pPageDict);
   m_pPDFPage = pdfium::MakeRetain<CPDF_Page>(GetDocument(), pPageDict);
   m_pPDFPage->SetRenderCache(
       std::make_unique<CPDF_PageRenderCache>(m_pPDFPage.Get()));
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp
index 86c7f34..b7b5fcd 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp
@@ -13,6 +13,7 @@
 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
 #include "fpdfsdk/fpdfxfa/cpdfxfa_widget.h"
 #include "public/fpdf_fwlevent.h"
+#include "third_party/base/check.h"
 #include "xfa/fgas/graphics/cfgas_gegraphics.h"
 #include "xfa/fwl/cfwl_app.h"
 #include "xfa/fwl/fwl_widgetdef.h"
@@ -233,7 +234,7 @@
                                    const CFX_Matrix& mtUser2Device,
                                    bool bDrawAnnots) {
   CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot);
-  ASSERT(pXFAWidget);
+  DCHECK(pXFAWidget);
 
   bool bIsHighlight = false;
   if (pPageView->GetFormFillEnv()->GetFocusAnnot() != pAnnot)
@@ -256,7 +257,7 @@
                                                  CPDFSDK_Annot* pAnnot) {
   CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot);
   CXFA_Node* node = pXFAWidget->GetXFAFFWidget()->GetNode();
-  ASSERT(node->IsWidgetReady());
+  DCHECK(node->IsWidgetReady());
 
   CFX_RectF rcBBox = pXFAWidget->GetXFAFFWidget()->GetBBox(
       node->GetFFWidgetType() == XFA_FFWidgetType::kSignature
diff --git a/fpdfsdk/pwl/cpwl_cblistbox.cpp b/fpdfsdk/pwl/cpwl_cblistbox.cpp
index 04b6f60..19e5d06 100644
--- a/fpdfsdk/pwl/cpwl_cblistbox.cpp
+++ b/fpdfsdk/pwl/cpwl_cblistbox.cpp
@@ -11,6 +11,7 @@
 #include "fpdfsdk/pwl/cpwl_combo_box.h"
 #include "fpdfsdk/pwl/cpwl_list_ctrl.h"
 #include "public/fpdf_fwlevent.h"
+#include "third_party/base/check.h"
 
 CPWL_CBListBox::CPWL_CBListBox(
     const CreateParams& cp,
@@ -51,7 +52,7 @@
 }
 
 bool CPWL_CBListBox::OnMovementKeyDown(uint16_t nChar, uint32_t nFlag) {
-  ASSERT(IsMovementKey(nChar));
+  DCHECK(IsMovementKey(nChar));
 
   switch (nChar) {
     case FWL_VKEY_Up:
diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp
index b26fbbc..bd35e47 100644
--- a/fpdfsdk/pwl/cpwl_edit.cpp
+++ b/fpdfsdk/pwl/cpwl_edit.cpp
@@ -27,6 +27,7 @@
 #include "fpdfsdk/pwl/cpwl_wnd.h"
 #include "fpdfsdk/pwl/ipwl_fillernotify.h"
 #include "public/fpdf_fwlevent.h"
+#include "third_party/base/check.h"
 
 CPWL_Edit::CPWL_Edit(
     const CreateParams& cp,
@@ -34,7 +35,7 @@
     : CPWL_EditCtrl(cp, std::move(pAttachedData)) {}
 
 CPWL_Edit::~CPWL_Edit() {
-  ASSERT(!m_bFocus);
+  DCHECK(!m_bFocus);
 }
 
 void CPWL_Edit::SetText(const WideString& csText) {
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp
index 75e49cc..307c635 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp
@@ -26,6 +26,7 @@
 #include "fpdfsdk/pwl/cpwl_edit_ctrl.h"
 #include "fpdfsdk/pwl/cpwl_scroll_bar.h"
 #include "fpdfsdk/pwl/ipwl_systemhandler.h"
+#include "third_party/base/check.h"
 #include "third_party/base/compiler_specific.h"
 
 namespace {
@@ -44,7 +45,7 @@
 
   CFX_PointF pos = mtUser2Device.Transform(pt);
   CPDF_RenderOptions ro;
-  ASSERT(ro.GetOptions().bClearType);
+  DCHECK(ro.GetOptions().bClearType);
   ro.SetColorMode(CPDF_RenderOptions::kNormal);
   CPDF_TextRenderer::DrawTextString(pDevice, pos.x, pos.y, pFont, fFontSize,
                                     mtUser2Device, str, crTextFill, ro);
@@ -68,7 +69,7 @@
 }
 
 bool CPWL_EditImpl_Iterator::GetWord(CPVT_Word& word) const {
-  ASSERT(m_pEdit);
+  DCHECK(m_pEdit);
 
   if (m_pVTIterator->GetWord(word)) {
     word.ptWord = m_pEdit->VTToEdit(word.ptWord);
@@ -78,7 +79,7 @@
 }
 
 bool CPWL_EditImpl_Iterator::GetLine(CPVT_Line& line) const {
-  ASSERT(m_pEdit);
+  DCHECK(m_pEdit);
 
   if (m_pVTIterator->GetLine(line)) {
     line.ptLine = m_pEdit->VTToEdit(line.ptLine);
@@ -101,7 +102,7 @@
 
 CPWL_EditImpl_Provider::CPWL_EditImpl_Provider(IPVT_FontMap* pFontMap)
     : CPDF_VariableText::Provider(pFontMap), m_pFontMap(pFontMap) {
-  ASSERT(m_pFontMap);
+  DCHECK(m_pFontMap);
 }
 
 CPWL_EditImpl_Provider::~CPWL_EditImpl_Provider() = default;
@@ -199,7 +200,7 @@
 }
 
 void CPWL_EditImpl_Undo::Undo() {
-  ASSERT(!m_bWorking);
+  DCHECK(!m_bWorking);
   m_bWorking = true;
   int nUndoRemain = 1;
   while (CanUndo() && nUndoRemain > 0) {
@@ -207,8 +208,8 @@
     m_nCurUndoPos--;
     nUndoRemain--;
   }
-  ASSERT(nUndoRemain == 0);
-  ASSERT(m_bWorking);
+  DCHECK(nUndoRemain == 0);
+  DCHECK(m_bWorking);
   m_bWorking = false;
 }
 
@@ -217,7 +218,7 @@
 }
 
 void CPWL_EditImpl_Undo::Redo() {
-  ASSERT(!m_bWorking);
+  DCHECK(!m_bWorking);
   m_bWorking = true;
   int nRedoRemain = 1;
   while (CanRedo() && nRedoRemain > 0) {
@@ -225,14 +226,14 @@
     m_nCurUndoPos++;
     nRedoRemain--;
   }
-  ASSERT(nRedoRemain == 0);
-  ASSERT(m_bWorking);
+  DCHECK(nRedoRemain == 0);
+  DCHECK(m_bWorking);
   m_bWorking = false;
 }
 
 void CPWL_EditImpl_Undo::AddItem(std::unique_ptr<IFX_Edit_UndoItem> pItem) {
-  ASSERT(!m_bWorking);
-  ASSERT(pItem);
+  DCHECK(!m_bWorking);
+  DCHECK(pItem);
   if (CanRedo())
     RemoveTails();
 
@@ -244,7 +245,7 @@
 }
 
 void CPWL_EditImpl_Undo::RemoveHeads() {
-  ASSERT(m_UndoItemStack.size() > 1);
+  DCHECK(m_UndoItemStack.size() > 1);
   m_UndoItemStack.pop_front();
 }
 
@@ -263,7 +264,7 @@
       m_wpNew(wpNewPlace),
       m_Word(word),
       m_nCharset(charset) {
-  ASSERT(m_pEdit);
+  DCHECK(m_pEdit);
 }
 
 CFXEU_InsertWord::~CFXEU_InsertWord() = default;
@@ -286,7 +287,7 @@
                                        const CPVT_WordPlace& wpOldPlace,
                                        const CPVT_WordPlace& wpNewPlace)
     : m_pEdit(pEdit), m_wpOld(wpOldPlace), m_wpNew(wpNewPlace) {
-  ASSERT(m_pEdit);
+  DCHECK(m_pEdit);
 }
 
 CFXEU_InsertReturn::~CFXEU_InsertReturn() = default;
@@ -308,7 +309,7 @@
 CFXEU_ReplaceSelection::CFXEU_ReplaceSelection(CPWL_EditImpl* pEdit,
                                                bool bIsEnd)
     : m_pEdit(pEdit), m_bEnd(bIsEnd) {
-  ASSERT(m_pEdit);
+  DCHECK(m_pEdit);
 }
 
 CFXEU_ReplaceSelection::~CFXEU_ReplaceSelection() = default;
@@ -340,7 +341,7 @@
       m_wpNew(wpNewPlace),
       m_Word(word),
       m_nCharset(charset) {
-  ASSERT(m_pEdit);
+  DCHECK(m_pEdit);
 }
 
 CFXEU_Backspace::~CFXEU_Backspace() = default;
@@ -374,7 +375,7 @@
       m_Word(word),
       m_nCharset(charset),
       m_bSecEnd(bSecEnd) {
-  ASSERT(m_pEdit);
+  DCHECK(m_pEdit);
 }
 
 CFXEU_Delete::~CFXEU_Delete() = default;
@@ -400,7 +401,7 @@
                          const CPVT_WordRange& wrSel,
                          const WideString& swText)
     : m_pEdit(pEdit), m_wrSel(wrSel), m_swText(swText) {
-  ASSERT(m_pEdit);
+  DCHECK(m_pEdit);
 }
 
 CFXEU_Clear::~CFXEU_Clear() = default;
@@ -430,7 +431,7 @@
       m_wpNew(wpNewPlace),
       m_swText(swText),
       m_nCharset(charset) {
-  ASSERT(m_pEdit);
+  DCHECK(m_pEdit);
 }
 
 CFXEU_InsertText::~CFXEU_InsertText() = default;
diff --git a/fpdfsdk/pwl/cpwl_icon.cpp b/fpdfsdk/pwl/cpwl_icon.cpp
index bade072..d45d63c 100644
--- a/fpdfsdk/pwl/cpwl_icon.cpp
+++ b/fpdfsdk/pwl/cpwl_icon.cpp
@@ -13,12 +13,13 @@
 #include "core/fpdfdoc/cpdf_icon.h"
 #include "core/fpdfdoc/cpdf_iconfit.h"
 #include "fpdfsdk/pwl/cpwl_wnd.h"
+#include "third_party/base/check.h"
 
 CPWL_Icon::CPWL_Icon(const CreateParams& cp,
                      std::unique_ptr<CPDF_Icon> pIcon,
                      CPDF_IconFit* pFit)
     : CPWL_Wnd(cp, nullptr), m_pIcon(std::move(pIcon)), m_pIconFit(pFit) {
-  ASSERT(m_pIcon);
+  DCHECK(m_pIcon);
 }
 
 CPWL_Icon::~CPWL_Icon() = default;
diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.cpp b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
index 83b0180..0fc0cf8 100644
--- a/fpdfsdk/pwl/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
@@ -15,6 +15,7 @@
 #include "core/fxge/cfx_pathdata.h"
 #include "core/fxge/cfx_renderdevice.h"
 #include "fpdfsdk/pwl/cpwl_wnd.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 namespace {
@@ -614,8 +615,8 @@
 }
 
 bool CPWL_ScrollBar::MovePosButton(bool bRefresh) {
-  ASSERT(m_pMinButton);
-  ASSERT(m_pMaxButton);
+  DCHECK(m_pMinButton);
+  DCHECK(m_pMaxButton);
 
   if (m_pPosButton->IsVisible()) {
     CFX_FloatRect rcClient;
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index e14ba36..5fbc24d 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -13,6 +13,7 @@
 #include "core/fxge/cfx_renderdevice.h"
 #include "fpdfsdk/pwl/cpwl_scroll_bar.h"
 #include "public/fpdf_fwlevent.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 namespace {
@@ -119,11 +120,11 @@
     : m_CreationParams(cp), m_pAttachedData(std::move(pAttachedData)) {}
 
 CPWL_Wnd::~CPWL_Wnd() {
-  ASSERT(!m_bCreated);
+  DCHECK(!m_bCreated);
 }
 
 void CPWL_Wnd::Realize() {
-  ASSERT(!m_bCreated);
+  DCHECK(!m_bCreated);
 
   m_CreationParams.rcRectWnd.Normalize();
   m_rcWindow = m_CreationParams.rcRectWnd;
@@ -372,13 +373,13 @@
 }
 
 void CPWL_Wnd::AddChild(std::unique_ptr<CPWL_Wnd> pWnd) {
-  ASSERT(!pWnd->m_pParent);
+  DCHECK(!pWnd->m_pParent);
   pWnd->m_pParent = this;
   m_Children.push_back(std::move(pWnd));
 }
 
 void CPWL_Wnd::RemoveChild(CPWL_Wnd* pWnd) {
-  ASSERT(pWnd->m_pParent == this);
+  DCHECK(pWnd->m_pParent == this);
   auto it = std::find(m_Children.begin(), m_Children.end(),
                       pdfium::FakeUniquePtr<CPWL_Wnd>(pWnd));
   if (it == m_Children.end())