[code health] Replace ASSERT() with DCHECK() in fpdfdoc/ and fpdftext/

Bug: pdfium:1596
Change-Id: I8b8eda186ae6a61d48079885f7e521bb36db29b2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/77670
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index a657ec3..ae39fde 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -26,6 +26,7 @@
 #include "core/fxge/cfx_graphstatedata.h"
 #include "core/fxge/cfx_pathdata.h"
 #include "core/fxge/cfx_renderdevice.h"
+#include "third_party/base/check.h"
 
 namespace {
 
@@ -179,13 +180,13 @@
 
 CPDF_Stream* GetAnnotAP(CPDF_Dictionary* pAnnotDict,
                         CPDF_Annot::AppearanceMode eMode) {
-  ASSERT(pAnnotDict);
+  DCHECK(pAnnotDict);
   return GetAnnotAPInternal(pAnnotDict, eMode, true);
 }
 
 CPDF_Stream* GetAnnotAPNoFallback(CPDF_Dictionary* pAnnotDict,
                                   CPDF_Annot::AppearanceMode eMode) {
-  ASSERT(pAnnotDict);
+  DCHECK(pAnnotDict);
   return GetAnnotAPInternal(pAnnotDict, eMode, false);
 }
 
@@ -210,8 +211,8 @@
 // static
 CFX_FloatRect CPDF_Annot::RectFromQuadPointsArray(const CPDF_Array* pArray,
                                                   size_t nIndex) {
-  ASSERT(pArray);
-  ASSERT(nIndex < pArray->size() / 8);
+  DCHECK(pArray);
+  DCHECK(nIndex < pArray->size() / 8);
 
   // QuadPoints are defined with 4 pairs of numbers
   // ([ pair0, pair1, pair2, pair3 ]), where
diff --git a/core/fpdfdoc/cpdf_filespec.cpp b/core/fpdfdoc/cpdf_filespec.cpp
index 36e8491..63148ee 100644
--- a/core/fpdfdoc/cpdf_filespec.cpp
+++ b/core/fpdfdoc/cpdf_filespec.cpp
@@ -15,6 +15,7 @@
 #include "core/fpdfapi/parser/cpdf_string.h"
 #include "core/fpdfapi/parser/fpdf_parser_decode.h"
 #include "core/fxcrt/fx_system.h"
+#include "third_party/base/check.h"
 #include "third_party/base/notreached.h"
 #include "third_party/base/stl_util.h"
 
@@ -55,12 +56,12 @@
 }  // namespace
 
 CPDF_FileSpec::CPDF_FileSpec(const CPDF_Object* pObj) : m_pObj(pObj) {
-  ASSERT(m_pObj);
+  DCHECK(m_pObj);
 }
 
 CPDF_FileSpec::CPDF_FileSpec(CPDF_Object* pObj)
     : m_pObj(pObj), m_pWritableObj(pObj) {
-  ASSERT(m_pObj);
+  DCHECK(m_pObj);
 }
 
 CPDF_FileSpec::~CPDF_FileSpec() = default;
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index 68d977c..42f7e91 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -15,6 +15,7 @@
 #include "core/fpdfapi/parser/fpdf_parser_decode.h"
 #include "core/fpdfapi/parser/fpdf_parser_utility.h"
 #include "core/fpdfdoc/cpdf_interactiveform.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 namespace {
@@ -48,7 +49,7 @@
 }
 
 ByteString CPDF_FormControl::GetOnStateName() const {
-  ASSERT(GetType() == CPDF_FormField::kCheckBox ||
+  DCHECK(GetType() == CPDF_FormField::kCheckBox ||
          GetType() == CPDF_FormField::kRadioButton);
   CPDF_Dictionary* pAP = m_pWidgetDict->GetDictFor("AP");
   if (!pAP)
@@ -67,7 +68,7 @@
 }
 
 ByteString CPDF_FormControl::GetCheckedAPState() const {
-  ASSERT(GetType() == CPDF_FormField::kCheckBox ||
+  DCHECK(GetType() == CPDF_FormField::kCheckBox ||
          GetType() == CPDF_FormField::kRadioButton);
   ByteString csOn = GetOnStateName();
   if (ToArray(CPDF_FormField::GetFieldAttr(m_pField->GetDict(), "Opt")))
@@ -78,7 +79,7 @@
 }
 
 WideString CPDF_FormControl::GetExportValue() const {
-  ASSERT(GetType() == CPDF_FormField::kCheckBox ||
+  DCHECK(GetType() == CPDF_FormField::kCheckBox ||
          GetType() == CPDF_FormField::kRadioButton);
   ByteString csOn = GetOnStateName();
   CPDF_Array* pArray =
@@ -91,7 +92,7 @@
 }
 
 bool CPDF_FormControl::IsChecked() const {
-  ASSERT(GetType() == CPDF_FormField::kCheckBox ||
+  DCHECK(GetType() == CPDF_FormField::kCheckBox ||
          GetType() == CPDF_FormField::kRadioButton);
   ByteString csOn = GetOnStateName();
   ByteString csAS = m_pWidgetDict->GetStringFor("AS");
@@ -99,7 +100,7 @@
 }
 
 bool CPDF_FormControl::IsDefaultChecked() const {
-  ASSERT(GetType() == CPDF_FormField::kCheckBox ||
+  DCHECK(GetType() == CPDF_FormField::kCheckBox ||
          GetType() == CPDF_FormField::kRadioButton);
   CPDF_Object* pDV = CPDF_FormField::GetFieldAttr(m_pField->GetDict(), "DV");
   if (!pDV)
@@ -111,7 +112,7 @@
 }
 
 void CPDF_FormControl::CheckControl(bool bChecked) {
-  ASSERT(GetType() == CPDF_FormField::kCheckBox ||
+  DCHECK(GetType() == CPDF_FormField::kCheckBox ||
          GetType() == CPDF_FormField::kRadioButton);
   ByteString csOldAS = m_pWidgetDict->GetStringFor("AS", "Off");
   ByteString csAS = "Off";
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index 9bbaa19..576e3ba 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -27,6 +27,7 @@
 #include "core/fpdfdoc/cpdf_formcontrol.h"
 #include "core/fpdfdoc/cpdf_interactiveform.h"
 #include "core/fpdfdoc/cpvt_generateap.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 namespace {
@@ -474,7 +475,7 @@
 }
 
 bool CPDF_FormField::IsItemSelected(int index) const {
-  ASSERT(GetType() == kComboBox || GetType() == kListBox);
+  DCHECK(GetType() == kComboBox || GetType() == kListBox);
   if (index < 0 || index >= CountOptions())
     return false;
 
@@ -486,7 +487,7 @@
 bool CPDF_FormField::SetItemSelection(int index,
                                       bool bSelected,
                                       NotificationOption notify) {
-  ASSERT(GetType() == kComboBox || GetType() == kListBox);
+  DCHECK(GetType() == kComboBox || GetType() == kListBox);
   if (index < 0 || index >= CountOptions())
     return false;
 
@@ -567,7 +568,7 @@
 }
 
 bool CPDF_FormField::IsItemDefaultSelected(int index) const {
-  ASSERT(GetType() == kComboBox || GetType() == kListBox);
+  DCHECK(GetType() == kComboBox || GetType() == kListBox);
   if (index < 0 || index >= CountOptions())
     return false;
   int iDVIndex = GetDefaultSelectedItem();
@@ -575,7 +576,7 @@
 }
 
 int CPDF_FormField::GetDefaultSelectedItem() const {
-  ASSERT(GetType() == kComboBox || GetType() == kListBox);
+  DCHECK(GetType() == kComboBox || GetType() == kListBox);
   const CPDF_Object* pValue = GetDefaultValueObject();
   if (!pValue)
     return -1;
@@ -628,7 +629,7 @@
 bool CPDF_FormField::CheckControl(int iControlIndex,
                                   bool bChecked,
                                   NotificationOption notify) {
-  ASSERT(GetType() == kCheckBox || GetType() == kRadioButton);
+  DCHECK(GetType() == kCheckBox || GetType() == kRadioButton);
   CPDF_FormControl* pControl = GetControl(iControlIndex);
   if (!pControl)
     return false;
@@ -680,7 +681,7 @@
 }
 
 WideString CPDF_FormField::GetCheckValue(bool bDefault) const {
-  ASSERT(GetType() == kCheckBox || GetType() == kRadioButton);
+  DCHECK(GetType() == kCheckBox || GetType() == kRadioButton);
   WideString csExport = L"Off";
   int iCount = CountControls();
   for (int i = 0; i < iCount; i++) {
@@ -698,7 +699,7 @@
 bool CPDF_FormField::SetCheckValue(const WideString& value,
                                    bool bDefault,
                                    NotificationOption notify) {
-  ASSERT(GetType() == kCheckBox || GetType() == kRadioButton);
+  DCHECK(GetType() == kCheckBox || GetType() == kRadioButton);
   int iCount = CountControls();
   for (int i = 0; i < iCount; i++) {
     CPDF_FormControl* pControl = GetControl(i);
@@ -828,7 +829,7 @@
 }
 
 bool CPDF_FormField::UseSelectedIndicesObject() const {
-  ASSERT(GetType() == kComboBox || GetType() == kListBox);
+  DCHECK(GetType() == kComboBox || GetType() == kListBox);
 
   const CPDF_Object* pSelectedIndicesObject = GetSelectedIndicesObject();
   if (!pSelectedIndicesObject)
@@ -896,7 +897,7 @@
     return values.empty();
   }
 
-  ASSERT(pSelectedIndicesObject->IsNumber());
+  DCHECK(pSelectedIndicesObject->IsNumber());
   int index = pSelectedIndicesObject->GetInteger();
   if (index < 0 || index >= num_options)
     return false;
@@ -995,12 +996,12 @@
 }
 
 const CPDF_Object* CPDF_FormField::GetSelectedIndicesObject() const {
-  ASSERT(GetType() == kComboBox || GetType() == kListBox);
+  DCHECK(GetType() == kComboBox || GetType() == kListBox);
   return GetFieldAttr(m_pDict.Get(), "I");
 }
 
 const CPDF_Object* CPDF_FormField::GetValueOrSelectedIndicesObject() const {
-  ASSERT(GetType() == kComboBox || GetType() == kListBox);
+  DCHECK(GetType() == kComboBox || GetType() == kListBox);
   const CPDF_Object* pValue = GetValueObject();
   return pValue ? pValue : GetSelectedIndicesObject();
 }
diff --git a/core/fpdfdoc/cpdf_interactiveform.cpp b/core/fpdfdoc/cpdf_interactiveform.cpp
index fb04ec3..c33549a 100644
--- a/core/fpdfdoc/cpdf_interactiveform.cpp
+++ b/core/fpdfdoc/cpdf_interactiveform.cpp
@@ -29,6 +29,7 @@
 #include "core/fxcrt/fx_codepage.h"
 #include "core/fxge/cfx_substfont.h"
 #include "core/fxge/fx_font.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 namespace {
@@ -125,7 +126,7 @@
   }
 
   const CPDF_Dictionary* pDict = pResDict->GetDictFor("Font");
-  ASSERT(pDict);
+  DCHECK(pDict);
 
   int num = 0;
   ByteString bsNum;
@@ -150,7 +151,7 @@
 }
 
 RetainPtr<CPDF_Font> AddNativeFont(uint8_t charSet, CPDF_Document* pDocument) {
-  ASSERT(pDocument);
+  DCHECK(pDocument);
 
 #if defined(OS_WIN)
   LOGFONTA lf;
@@ -238,8 +239,8 @@
              CPDF_Document* pDocument,
              const RetainPtr<CPDF_Font>& pFont,
              ByteString* csNameTag) {
-  ASSERT(pFormDict);
-  ASSERT(pFont);
+  DCHECK(pFormDict);
+  DCHECK(pFont);
 
   ByteString csTag;
   if (FindFont(pFormDict, pFont.Get(), &csTag)) {
@@ -269,7 +270,7 @@
 }
 
 void InitDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) {
-  ASSERT(pDocument);
+  DCHECK(pDocument);
 
   if (!pFormDict) {
     pFormDict = pDocument->NewIndirect<CPDF_Dictionary>();
@@ -577,12 +578,12 @@
     CPDF_Dictionary*& pFormDict,
     CPDF_Document* pDocument,
     ByteString* csNameTag) {
-  ASSERT(pDocument);
-  ASSERT(csNameTag);
+  DCHECK(pDocument);
+  DCHECK(csNameTag);
 
   if (!pFormDict)
     InitDict(pFormDict, pDocument);
-  ASSERT(pFormDict);
+  DCHECK(pFormDict);
 
   uint8_t charSet = GetNativeCharSet();
   ByteString csTemp;
diff --git a/core/fpdfdoc/cpdf_metadata.cpp b/core/fpdfdoc/cpdf_metadata.cpp
index da8dcb9..3735247 100644
--- a/core/fpdfdoc/cpdf_metadata.cpp
+++ b/core/fpdfdoc/cpdf_metadata.cpp
@@ -15,6 +15,7 @@
 #include "core/fxcrt/xml/cfx_xmldocument.h"
 #include "core/fxcrt/xml/cfx_xmlelement.h"
 #include "core/fxcrt/xml/cfx_xmlparser.h"
+#include "third_party/base/check.h"
 
 namespace {
 
@@ -61,7 +62,7 @@
 }  // namespace
 
 CPDF_Metadata::CPDF_Metadata(const CPDF_Stream* pStream) : stream_(pStream) {
-  ASSERT(pStream);
+  DCHECK(pStream);
 }
 
 CPDF_Metadata::~CPDF_Metadata() = default;
diff --git a/core/fpdfdoc/cpdf_nametree.cpp b/core/fpdfdoc/cpdf_nametree.cpp
index 07e172b..546a573 100644
--- a/core/fpdfdoc/cpdf_nametree.cpp
+++ b/core/fpdfdoc/cpdf_nametree.cpp
@@ -15,6 +15,7 @@
 #include "core/fpdfapi/parser/cpdf_reference.h"
 #include "core/fpdfapi/parser/cpdf_string.h"
 #include "core/fpdfapi/parser/fpdf_parser_decode.h"
+#include "third_party/base/check.h"
 #include "third_party/base/ptr_util.h"
 
 namespace {
@@ -22,7 +23,7 @@
 constexpr int kNameTreeMaxRecursion = 32;
 
 std::pair<WideString, WideString> GetNodeLimitsMaybeSwap(CPDF_Array* pLimits) {
-  ASSERT(pLimits);
+  DCHECK(pLimits);
   WideString csLeft = pLimits->GetUnicodeTextAt(0);
   WideString csRight = pLimits->GetUnicodeTextAt(1);
   // If the lower limit is greater than the upper limit, swap them.
@@ -136,7 +137,7 @@
     WideString csNewRight = csLeft;
     for (size_t j = 0; j < pKids->size(); ++j) {
       CPDF_Array* pKidLimits = pKids->GetDictAt(j)->GetArrayFor("Limits");
-      ASSERT(pKidLimits);
+      DCHECK(pKidLimits);
       if (pKidLimits->GetUnicodeTextAt(0).Compare(csNewLeft) < 0)
         csNewLeft = pKidLimits->GetUnicodeTextAt(0);
       if (pKidLimits->GetUnicodeTextAt(1).Compare(csNewRight) > 0)
@@ -319,7 +320,7 @@
 }  // namespace
 
 CPDF_NameTree::CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {
-  ASSERT(m_pRoot);
+  DCHECK(m_pRoot);
 }
 
 CPDF_NameTree::~CPDF_NameTree() = default;
diff --git a/core/fpdfdoc/cpdf_structelement.cpp b/core/fpdfdoc/cpdf_structelement.cpp
index 86bd847..7040c6c 100644
--- a/core/fpdfdoc/cpdf_structelement.cpp
+++ b/core/fpdfdoc/cpdf_structelement.cpp
@@ -16,6 +16,7 @@
 #include "core/fpdfapi/parser/cpdf_reference.h"
 #include "core/fpdfapi/parser/cpdf_stream.h"
 #include "core/fpdfdoc/cpdf_structtree.h"
+#include "third_party/base/check.h"
 
 namespace {
 
@@ -78,7 +79,7 @@
   if (!pKids)
     return;
 
-  ASSERT(m_Kids.empty());
+  DCHECK(m_Kids.empty());
   if (const CPDF_Array* pArray = pKids->AsArray()) {
     m_Kids.resize(pArray->size());
     for (size_t i = 0; i < pArray->size(); ++i) {
diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp
index f96f4c2..7e87e5c 100644
--- a/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/core/fpdfdoc/cpdf_variabletext.cpp
@@ -16,6 +16,7 @@
 #include "core/fpdfdoc/csection.h"
 #include "core/fpdfdoc/ipvt_fontmap.h"
 #include "core/fxcrt/fx_codepage.h"
+#include "third_party/base/check.h"
 #include "third_party/base/compiler_specific.h"
 #include "third_party/base/stl_util.h"
 
@@ -32,7 +33,7 @@
 
 CPDF_VariableText::Provider::Provider(IPVT_FontMap* pFontMap)
     : m_pFontMap(pFontMap) {
-  ASSERT(m_pFontMap);
+  DCHECK(m_pFontMap);
 }
 
 CPDF_VariableText::Provider::~Provider() = default;
@@ -93,7 +94,7 @@
 }
 
 void CPDF_VariableText::Iterator::SetAt(const CPVT_WordPlace& place) {
-  ASSERT(m_pVT);
+  DCHECK(m_pVT);
   m_CurPos = place;
 }
 
@@ -157,7 +158,7 @@
 }
 
 bool CPDF_VariableText::Iterator::GetLine(CPVT_Line& line) const {
-  ASSERT(m_pVT);
+  DCHECK(m_pVT);
   line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1);
   if (!pdfium::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
     return false;
diff --git a/core/fpdfdoc/cpvt_fontmap.cpp b/core/fpdfdoc/cpvt_fontmap.cpp
index ccfaa87..87b905c 100644
--- a/core/fpdfdoc/cpvt_fontmap.cpp
+++ b/core/fpdfdoc/cpvt_fontmap.cpp
@@ -13,6 +13,7 @@
 #include "core/fpdfapi/parser/fpdf_parser_utility.h"
 #include "core/fpdfdoc/cpdf_interactiveform.h"
 #include "core/fxcrt/fx_codepage.h"
+#include "third_party/base/check.h"
 #include "third_party/base/notreached.h"
 
 CPVT_FontMap::CPVT_FontMap(CPDF_Document* pDoc,
@@ -31,7 +32,7 @@
     CPDF_Document* pDoc,
     CPDF_Dictionary* pResDict,
     ByteString* pSysFontAlias) {
-  ASSERT(pSysFontAlias);
+  DCHECK(pSysFontAlias);
   if (!pDoc || !pResDict)
     return nullptr;
 
diff --git a/core/fpdfdoc/csection.cpp b/core/fpdfdoc/csection.cpp
index 9349bd5..c3b8adb 100644
--- a/core/fpdfdoc/csection.cpp
+++ b/core/fpdfdoc/csection.cpp
@@ -11,10 +11,11 @@
 #include "core/fpdfdoc/cline.h"
 #include "core/fpdfdoc/cpdf_variabletext.h"
 #include "core/fpdfdoc/cpvt_wordinfo.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 CSection::CSection(CPDF_VariableText* pVT) : m_pVT(pVT) {
-  ASSERT(m_pVT);
+  DCHECK(m_pVT);
 }
 
 CSection::~CSection() = default;
diff --git a/core/fpdfdoc/ctypeset.cpp b/core/fpdfdoc/ctypeset.cpp
index 8c61f9e..ea5c9e0 100644
--- a/core/fpdfdoc/ctypeset.cpp
+++ b/core/fpdfdoc/ctypeset.cpp
@@ -12,6 +12,7 @@
 #include "core/fpdfdoc/cpdf_variabletext.h"
 #include "core/fpdfdoc/cpvt_wordinfo.h"
 #include "core/fpdfdoc/csection.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 namespace {
@@ -259,14 +260,14 @@
 }
 
 CFX_SizeF CTypeset::GetEditSize(float fFontSize) {
-  ASSERT(m_pSection);
-  ASSERT(m_pVT);
+  DCHECK(m_pSection);
+  DCHECK(m_pVT);
   SplitLines(false, fFontSize);
   return CFX_SizeF(m_rcRet.Width(), m_rcRet.Height());
 }
 
 CPVT_FloatRect CTypeset::Typeset() {
-  ASSERT(m_pVT);
+  DCHECK(m_pVT);
   m_pSection->m_LineArray.clear();
   SplitLines(true, 0.0f);
   OutputLines();
@@ -274,8 +275,8 @@
 }
 
 void CTypeset::SplitLines(bool bTypeset, float fFontSize) {
-  ASSERT(m_pVT);
-  ASSERT(m_pSection);
+  DCHECK(m_pVT);
+  DCHECK(m_pSection);
 
   CPVT_LineInfo line;
   if (m_pSection->m_WordArray.empty()) {
@@ -427,8 +428,8 @@
 }
 
 void CTypeset::OutputLines() {
-  ASSERT(m_pVT);
-  ASSERT(m_pSection);
+  DCHECK(m_pVT);
+  DCHECK(m_pSection);
   float fMinX;
   float fLineIndent = m_pVT->GetLineIndent();
   float fTypesetWidth = std::max(m_pVT->GetPlateWidth() - fLineIndent, 0.0f);
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 98c02da1..7172f68 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -25,6 +25,7 @@
 #include "core/fxcrt/fx_extension.h"
 #include "core/fxcrt/fx_memory_wrappers.h"
 #include "core/fxcrt/fx_unicode.h"
+#include "third_party/base/check.h"
 #include "third_party/base/check_op.h"
 #include "third_party/base/stl_util.h"
 
@@ -38,8 +39,8 @@
     g_UnicodeData_Normalization_Map4};
 
 float NormalizeThreshold(float threshold, int t1, int t2, int t3) {
-  ASSERT(t1 < t2);
-  ASSERT(t2 < t3);
+  DCHECK(t1 < t2);
+  DCHECK(t2 < t3);
   if (threshold < t1)
     return threshold / 2.0f;
   if (threshold < t2)
@@ -367,7 +368,7 @@
 
   if (count < 0 || start + count > number_of_chars)
     count = number_of_chars - start;
-  ASSERT(count > 0);
+  DCHECK(count > 0);
 
   CPDF_TextObject* text_object = nullptr;
   CFX_FloatRect rect;
@@ -943,7 +944,7 @@
 
 void CPDF_TextPage::SwapTempTextBuf(int iCharListStartAppend,
                                     int iBufStartAppend) {
-  ASSERT(!m_TempCharList.empty());
+  DCHECK(!m_TempCharList.empty());
   int i = iCharListStartAppend;
   int j = pdfium::CollectionSize<int>(m_TempCharList) - 1;
   for (; i < j; ++i, --j) {
@@ -952,7 +953,7 @@
   }
 
   pdfium::span<wchar_t> temp_span = m_TempTextBuf.GetWideSpan();
-  ASSERT(!temp_span.empty());
+  DCHECK(!temp_span.empty());
   i = iBufStartAppend;
   j = pdfium::CollectionSize<int>(temp_span) - 1;
   for (; i < j; ++i, --j)
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 3df499f..2bc46f1 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -14,6 +14,7 @@
 #include "core/fxcrt/fx_extension.h"
 #include "core/fxcrt/fx_string.h"
 #include "core/fxcrt/fx_system.h"
+#include "third_party/base/check.h"
 #include "third_party/base/ptr_util.h"
 #include "third_party/base/stl_util.h"
 
@@ -91,7 +92,7 @@
 
 Optional<WideString> ExtractSubString(const wchar_t* lpszFullString,
                                       int iSubString) {
-  ASSERT(lpszFullString);
+  DCHECK(lpszFullString);
 
   while (iSubString--) {
     lpszFullString = std::wcschr(lpszFullString, L' ');