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

Bug: pdfium:1596
Change-Id: Ia4cbad2f085053cc52821e416c4f36bce5fa2209
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/77570
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/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index 6b35899..99606b5 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -170,7 +170,7 @@
 
   uint8_t* dest_buf = buffer + dest_top * pitch + dest_left * Bpp;
   if (dest_format == FXDIB_Format::kRgb) {
-    ASSERT(src_format == FXDIB_Format::kRgb32);
+    DCHECK(src_format == FXDIB_Format::kRgb32);
     for (int row = 0; row < height; row++) {
       uint8_t* dest_scan = dest_buf + row * pitch;
       const uint8_t* src_scan =
@@ -185,7 +185,7 @@
     return;
   }
 
-  ASSERT(dest_format == FXDIB_Format::kArgb ||
+  DCHECK(dest_format == FXDIB_Format::kArgb ||
          dest_format == FXDIB_Format::kRgb32);
   if (src_format == FXDIB_Format::kRgb) {
     for (int row = 0; row < height; row++) {
@@ -203,7 +203,7 @@
   }
   if (src_format != FXDIB_Format::kRgb32)
     return;
-  ASSERT(dest_format == FXDIB_Format::kArgb);
+  DCHECK(dest_format == FXDIB_Format::kArgb);
   for (int row = 0; row < height; row++) {
     uint8_t* dest_scan = dest_buf + row * pitch;
     const uint8_t* src_scan =
@@ -587,7 +587,7 @@
                                      int clip_right,
                                      uint8_t* clip_scan,
                                      uint8_t* dest_extra_alpha_scan) {
-  ASSERT(!m_bRgbByteOrder);
+  DCHECK(!m_bRgbByteOrder);
   int col_start = GetColStart(span_left, clip_left);
   int col_end = GetColEnd(span_left, span_len, clip_right);
   dest_scan += col_start / 8;
@@ -604,7 +604,7 @@
                                      int clip_right,
                                      uint8_t* clip_scan,
                                      uint8_t* dest_extra_alpha_scan) {
-  ASSERT(!m_bRgbByteOrder);
+  DCHECK(!m_bRgbByteOrder);
   int col_start = GetColStart(span_left, clip_left);
   int col_end = GetColEnd(span_left, span_len, clip_right);
   dest_scan += col_start;
@@ -824,7 +824,7 @@
       m_pClipRgn(pClipRgn),
       m_CompositeSpanFunc(GetCompositeSpanFunc(m_pDevice)) {
   if (m_pDevice->GetBPP() == 8) {
-    ASSERT(!m_bRgbByteOrder);
+    DCHECK(!m_bRgbByteOrder);
     if (m_pDevice->IsMask())
       m_Gray = 255;
     else
@@ -1125,7 +1125,7 @@
     const CFX_PathData* pPathData,
     const CFX_Matrix* pObject2Device,
     const CFX_FillRenderOptions& fill_options) {
-  ASSERT(fill_options.fill_type != CFX_FillRenderOptions::FillType::kNoFill);
+  DCHECK(fill_options.fill_type != CFX_FillRenderOptions::FillType::kNoFill);
 
   m_FillOptions = fill_options;
   if (!m_pClipRgn) {
diff --git a/core/fxge/cfx_cliprgn.cpp b/core/fxge/cfx_cliprgn.cpp
index 5cb9692..dccfecf 100644
--- a/core/fxge/cfx_cliprgn.cpp
+++ b/core/fxge/cfx_cliprgn.cpp
@@ -9,6 +9,7 @@
 #include <utility>
 
 #include "core/fxge/dib/cfx_dibitmap.h"
+#include "third_party/base/check.h"
 #include "third_party/base/notreached.h"
 
 CFX_ClipRgn::CFX_ClipRgn(int width, int height)
@@ -59,7 +60,7 @@
 void CFX_ClipRgn::IntersectMaskF(int left,
                                  int top,
                                  const RetainPtr<CFX_DIBitmap>& pMask) {
-  ASSERT(pMask->GetFormat() == FXDIB_Format::k8bppMask);
+  DCHECK(pMask->GetFormat() == FXDIB_Format::k8bppMask);
   FX_RECT mask_box(left, top, left + pMask->GetWidth(),
                    top + pMask->GetHeight());
   if (m_Type == RectI) {
diff --git a/core/fxge/cfx_drawutils.cpp b/core/fxge/cfx_drawutils.cpp
index ce569b0..492d2e5 100644
--- a/core/fxge/cfx_drawutils.cpp
+++ b/core/fxge/cfx_drawutils.cpp
@@ -10,12 +10,13 @@
 #include "core/fxge/cfx_graphstatedata.h"
 #include "core/fxge/cfx_pathdata.h"
 #include "core/fxge/cfx_renderdevice.h"
+#include "third_party/base/check.h"
 
 // static
 void CFX_DrawUtils::DrawFocusRect(CFX_RenderDevice* render_device,
                                   const CFX_Matrix& user_to_device,
                                   const CFX_FloatRect& view_bounding_box) {
-  ASSERT(render_device);
+  DCHECK(render_device);
   CFX_PathData path;
   path.AppendPoint(CFX_PointF(view_bounding_box.left, view_bounding_box.top),
                    FXPT_TYPE::MoveTo);
diff --git a/core/fxge/cfx_face.cpp b/core/fxge/cfx_face.cpp
index 12f79fe..1946843 100644
--- a/core/fxge/cfx_face.cpp
+++ b/core/fxge/cfx_face.cpp
@@ -4,6 +4,8 @@
 
 #include "core/fxge/cfx_face.h"
 
+#include "third_party/base/check.h"
+
 // static
 RetainPtr<CFX_Face> CFX_Face::New(FT_Library library,
                                   const RetainPtr<Retainable>& pDesc,
@@ -30,7 +32,7 @@
 
 CFX_Face::CFX_Face(FXFT_FaceRec* rec, const RetainPtr<Retainable>& pDesc)
     : m_pRec(rec), m_pDesc(pDesc) {
-  ASSERT(m_pRec);
+  DCHECK(m_pRec);
 }
 
 CFX_Face::~CFX_Face() = default;
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index 99dad64..d3d27f0 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -23,6 +23,7 @@
 #include "core/fxge/cfx_substfont.h"
 #include "core/fxge/fx_font.h"
 #include "core/fxge/scoped_font_transform.h"
+#include "third_party/base/check.h"
 #include "third_party/base/span.h"
 #include "third_party/base/stl_util.h"
 
@@ -592,7 +593,7 @@
 void CFX_Font::AdjustMMParams(int glyph_index,
                               int dest_width,
                               int weight) const {
-  ASSERT(dest_width >= 0);
+  DCHECK(dest_width >= 0);
   FXFT_MM_VarPtr pMasters = nullptr;
   FT_Get_MM_Var(m_Face->GetRec(), &pMasters);
   if (!pMasters)
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index 2ac33dd..1e69776 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -21,6 +21,7 @@
 #include "core/fxge/cfx_substfont.h"
 #include "core/fxge/fx_font.h"
 #include "core/fxge/systemfontinfo_iface.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 namespace {
@@ -735,7 +736,7 @@
     pFontDesc = m_pFontMgr->AddCachedTTCFontDesc(
         ttc_size, checksum, std::move(pFontData), ttc_size);
   }
-  ASSERT(ttc_size >= font_size);
+  DCHECK(ttc_size >= font_size);
   uint32_t font_offset = ttc_size - font_size;
   int face_index =
       GetTTCIndex(pFontDesc->FontData().first(ttc_size), font_offset);
diff --git a/core/fxge/cfx_fontmgr.cpp b/core/fxge/cfx_fontmgr.cpp
index e90910a..4669a47 100644
--- a/core/fxge/cfx_fontmgr.cpp
+++ b/core/fxge/cfx_fontmgr.cpp
@@ -15,6 +15,7 @@
 #include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
 #include "core/fxge/fx_font.h"
 #include "core/fxge/systemfontinfo_iface.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 namespace {
@@ -75,12 +76,12 @@
 CFX_FontMgr::FontDesc::~FontDesc() = default;
 
 void CFX_FontMgr::FontDesc::SetFace(size_t index, CFX_Face* face) {
-  ASSERT(index < pdfium::size(m_TTCFaces));
+  DCHECK(index < pdfium::size(m_TTCFaces));
   m_TTCFaces[index].Reset(face);
 }
 
 CFX_Face* CFX_FontMgr::FontDesc::GetFace(size_t index) const {
-  ASSERT(index < pdfium::size(m_TTCFaces));
+  DCHECK(index < pdfium::size(m_TTCFaces));
   return m_TTCFaces[index].Get();
 }
 
diff --git a/core/fxge/cfx_gemodule.cpp b/core/fxge/cfx_gemodule.cpp
index 46cfbee..027b8b8 100644
--- a/core/fxge/cfx_gemodule.cpp
+++ b/core/fxge/cfx_gemodule.cpp
@@ -9,6 +9,7 @@
 #include "core/fxge/cfx_folderfontinfo.h"
 #include "core/fxge/cfx_fontcache.h"
 #include "core/fxge/cfx_fontmgr.h"
+#include "third_party/base/check.h"
 
 namespace {
 
@@ -26,7 +27,7 @@
 
 // static
 void CFX_GEModule::Create(const char** pUserFontPaths) {
-  ASSERT(!g_pGEModule);
+  DCHECK(!g_pGEModule);
   g_pGEModule = new CFX_GEModule(pUserFontPaths);
   g_pGEModule->m_pPlatform->Init();
   g_pGEModule->GetFontMgr()->SetSystemFontInfo(
@@ -35,13 +36,13 @@
 
 // static
 void CFX_GEModule::Destroy() {
-  ASSERT(g_pGEModule);
+  DCHECK(g_pGEModule);
   delete g_pGEModule;
   g_pGEModule = nullptr;
 }
 
 // static
 CFX_GEModule* CFX_GEModule::Get() {
-  ASSERT(g_pGEModule);
+  DCHECK(g_pGEModule);
   return g_pGEModule;
 }
diff --git a/core/fxge/cfx_pathdata.cpp b/core/fxge/cfx_pathdata.cpp
index d1ac1fb..908a980 100644
--- a/core/fxge/cfx_pathdata.cpp
+++ b/core/fxge/cfx_pathdata.cpp
@@ -7,6 +7,7 @@
 #include "core/fxge/cfx_pathdata.h"
 
 #include "core/fxcrt/fx_system.h"
+#include "third_party/base/check.h"
 #include "third_party/base/numerics/safe_math.h"
 
 namespace {
@@ -391,7 +392,7 @@
       continue;
     }
 
-    ASSERT(point_type == FXPT_TYPE::LineTo);
+    DCHECK(point_type == FXPT_TYPE::LineTo);
     int next_index =
         (i + 1 - startPoint) % (m_Points.size() - startPoint) + startPoint;
     const FX_PATHPOINT& next = m_Points[next_index];
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 7ea676a..5738027 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -29,6 +29,7 @@
 #include "core/fxge/renderdevicedriver_iface.h"
 #include "core/fxge/text_char_pos.h"
 #include "core/fxge/text_glyph_pos.h"
+#include "third_party/base/check.h"
 #include "third_party/base/notreached.h"
 #include "third_party/base/span.h"
 
@@ -39,7 +40,7 @@
 namespace {
 
 void AdjustGlyphSpace(std::vector<TextGlyphPos>* pGlyphAndPos) {
-  ASSERT(pGlyphAndPos->size() > 1);
+  DCHECK(pGlyphAndPos->size() > 1);
   std::vector<TextGlyphPos>& glyphs = *pGlyphAndPos;
   bool bVertical = glyphs.back().m_Origin.x == glyphs.front().m_Origin.x;
   if (!bVertical && (glyphs.back().m_Origin.y != glyphs.front().m_Origin.y))
@@ -98,8 +99,8 @@
 };
 
 int TextGammaAdjust(int value) {
-  ASSERT(value >= 0);
-  ASSERT(value <= 255);
+  DCHECK(value >= 0);
+  DCHECK(value <= 255);
   return g_TextGammaAdjust[value];
 }
 
@@ -343,8 +344,8 @@
 
 void CFX_RenderDevice::SetDeviceDriver(
     std::unique_ptr<RenderDeviceDriverIface> pDriver) {
-  ASSERT(pDriver);
-  ASSERT(!m_pDeviceDriver);
+  DCHECK(pDriver);
+  DCHECK(!m_pDeviceDriver);
   m_pDeviceDriver = std::move(pDriver);
   InitDeviceInfo();
 }
@@ -689,7 +690,7 @@
                                           int left,
                                           int top,
                                           BlendMode blend_mode) {
-  ASSERT(!pBitmap->IsMask());
+  DCHECK(!pBitmap->IsMask());
   FX_RECT dest_rect(left, top, left + pBitmap->GetWidth(),
                     top + pBitmap->GetHeight());
   dest_rect.Intersect(m_ClipBox);
@@ -1075,7 +1076,7 @@
 void CFX_RenderDevice::DrawFillArea(const CFX_Matrix& mtUser2Device,
                                     const std::vector<CFX_PointF>& points,
                                     const FX_COLORREF& color) {
-  ASSERT(!points.empty());
+  DCHECK(!points.empty());
   CFX_PathData path;
   path.AppendPoint(points[0], FXPT_TYPE::MoveTo);
   for (size_t i = 1; i < points.size(); ++i)
diff --git a/core/fxge/cfx_windowsrenderdevice.cpp b/core/fxge/cfx_windowsrenderdevice.cpp
index 698a4d6..e2579ae 100644
--- a/core/fxge/cfx_windowsrenderdevice.cpp
+++ b/core/fxge/cfx_windowsrenderdevice.cpp
@@ -16,6 +16,7 @@
 #include "core/fxge/win32/cgdi_printer_driver.h"
 #include "core/fxge/win32/cps_printer_driver.h"
 #include "core/fxge/win32/ctext_only_printer_driver.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 namespace {
@@ -465,6 +466,6 @@
 
 #if defined(_SKIA_SUPPORT_)
 void CFX_WindowsRenderDevice::DebugVerifyBitmapIsPreMultiplied() const {
-  ASSERT(GetDeviceCaps(FXDC_BITS_PIXEL) == 32);
+  DCHECK(GetDeviceCaps(FXDC_BITS_PIXEL) == 32);
 }
 #endif
diff --git a/core/fxge/dib/cfx_cmyk_to_srgb.cpp b/core/fxge/dib/cfx_cmyk_to_srgb.cpp
index d75987c..df9a451 100644
--- a/core/fxge/dib/cfx_cmyk_to_srgb.cpp
+++ b/core/fxge/dib/cfx_cmyk_to_srgb.cpp
@@ -10,6 +10,7 @@
 #include <tuple>
 
 #include "core/fxcrt/fx_system.h"
+#include "third_party/base/check.h"
 
 namespace fxge {
 
@@ -1740,10 +1741,10 @@
   uint8_t y1 = static_cast<int>(y * 255.f + rounding_offset);
   uint8_t k1 = static_cast<int>(k * 255.f + rounding_offset);
 
-  ASSERT(c1 == FXSYS_roundf(c * 255));
-  ASSERT(m1 == FXSYS_roundf(m * 255));
-  ASSERT(y1 == FXSYS_roundf(y * 255));
-  ASSERT(k1 == FXSYS_roundf(k * 255));
+  DCHECK(c1 == FXSYS_roundf(c * 255));
+  DCHECK(m1 == FXSYS_roundf(m * 255));
+  DCHECK(y1 == FXSYS_roundf(y * 255));
+  DCHECK(k1 == FXSYS_roundf(k * 255));
 
   uint8_t r;
   uint8_t g;
diff --git a/core/fxge/dib/cfx_dibbase.cpp b/core/fxge/dib/cfx_dibbase.cpp
index cff1d79..137556e 100644
--- a/core/fxge/dib/cfx_dibbase.cpp
+++ b/core/fxge/dib/cfx_dibbase.cpp
@@ -18,6 +18,7 @@
 #include "core/fxge/dib/cfx_dibitmap.h"
 #include "core/fxge/dib/cfx_imagestretcher.h"
 #include "core/fxge/dib/cfx_imagetransformer.h"
+#include "third_party/base/check.h"
 #include "third_party/base/notreached.h"
 #include "third_party/base/span.h"
 #include "third_party/base/stl_util.h"
@@ -683,7 +684,7 @@
 }
 
 uint32_t CFX_DIBBase::GetPaletteArgb(int index) const {
-  ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsMask());
+  DCHECK((GetBPP() == 1 || GetBPP() == 8) && !IsMask());
   if (HasPalette())
     return GetPaletteSpan()[index];
 
@@ -694,13 +695,13 @@
 }
 
 void CFX_DIBBase::SetPaletteArgb(int index, uint32_t color) {
-  ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsMask());
+  DCHECK((GetBPP() == 1 || GetBPP() == 8) && !IsMask());
   BuildPalette();
   m_palette[index] = color;
 }
 
 int CFX_DIBBase::FindPalette(uint32_t color) const {
-  ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsMask());
+  DCHECK((GetBPP() == 1 || GetBPP() == 8) && !IsMask());
   if (HasPalette()) {
     int palsize = (1 << GetBPP());
     pdfium::span<const uint32_t> palette = GetPaletteSpan();
@@ -728,8 +729,8 @@
   if (width == 0 || height == 0)
     return false;
 
-  ASSERT(width > 0);
-  ASSERT(height > 0);
+  DCHECK(width > 0);
+  DCHECK(height > 0);
 
   if (dest_left > m_Width || dest_top > m_Height)
     return false;
@@ -825,7 +826,7 @@
 }
 
 void CFX_DIBBase::GetPalette(uint32_t* pal, int alpha) const {
-  ASSERT(GetBPP() <= 8);
+  DCHECK(GetBPP() <= 8);
 
   if (GetBPP() == 1) {
     pal[0] = ((HasPalette() ? GetPaletteSpan()[0] : 0xff000000) & 0xffffff) |
@@ -845,7 +846,7 @@
 }
 
 RetainPtr<CFX_DIBitmap> CFX_DIBBase::CloneAlphaMask() const {
-  ASSERT(GetFormat() == FXDIB_Format::kArgb);
+  DCHECK(GetFormat() == FXDIB_Format::kArgb);
   FX_RECT rect(0, 0, m_Width, m_Height);
   auto pMask = pdfium::MakeRetain<CFX_DIBitmap>();
   if (!pMask->Create(rect.Width(), rect.Height(), FXDIB_Format::k8bppMask))
@@ -931,7 +932,7 @@
         src_scan += 3;
       }
     } else {
-      ASSERT(Bpp == 4);
+      DCHECK(Bpp == 4);
       for (int col = 0; col < m_Width; ++col) {
         const auto* src_scan32 = reinterpret_cast<const uint32_t*>(src_scan);
         uint32_t* dest_scan32 = reinterpret_cast<uint32_t*>(dest_scan);
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp
index 1052b35..5012d44 100644
--- a/core/fxge/dib/cfx_dibitmap.cpp
+++ b/core/fxge/dib/cfx_dibitmap.cpp
@@ -776,7 +776,7 @@
   RetainPtr<CFX_DIBitmap> pClipMask;
   FX_RECT clip_box;
   if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) {
-    ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF);
+    DCHECK(pClipRgn->GetType() == CFX_ClipRgn::MaskF);
     pClipMask = pClipRgn->GetMask();
     clip_box = pClipRgn->GetBox();
   }
@@ -859,7 +859,7 @@
   RetainPtr<CFX_DIBitmap> pClipMask;
   FX_RECT clip_box;
   if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) {
-    ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF);
+    DCHECK(pClipRgn->GetType() == CFX_ClipRgn::MaskF);
     pClipMask = pClipRgn->GetMask();
     clip_box = pClipRgn->GetBox();
   }
diff --git a/core/fxge/dib/cfx_imagestretcher.cpp b/core/fxge/dib/cfx_imagestretcher.cpp
index e8a6451..3f38cc3 100644
--- a/core/fxge/dib/cfx_imagestretcher.cpp
+++ b/core/fxge/dib/cfx_imagestretcher.cpp
@@ -12,6 +12,7 @@
 #include "core/fxge/dib/cfx_dibitmap.h"
 #include "core/fxge/dib/cstretchengine.h"
 #include "core/fxge/dib/fx_dib.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 namespace {
@@ -48,7 +49,7 @@
       m_DestHeight(dest_height),
       m_ClipRect(bitmap_rect),
       m_DestFormat(GetStretchedFormat(*pSource)) {
-  ASSERT(m_ClipRect.Valid());
+  DCHECK(m_ClipRect.Valid());
 }
 
 CFX_ImageStretcher::~CFX_ImageStretcher() = default;
diff --git a/core/fxge/dib/cstretchengine.cpp b/core/fxge/dib/cstretchengine.cpp
index b1ea7f6..61786e3 100644
--- a/core/fxge/dib/cstretchengine.cpp
+++ b/core/fxge/dib/cstretchengine.cpp
@@ -14,6 +14,7 @@
 #include "core/fxge/dib/cfx_dibitmap.h"
 #include "core/fxge/dib/fx_dib.h"
 #include "core/fxge/dib/scanlinecomposer_iface.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 namespace {
@@ -126,7 +127,7 @@
 
 const PixelWeight* CStretchEngine::CWeightTable::GetPixelWeight(
     int pixel) const {
-  ASSERT(pixel >= m_DestMin);
+  DCHECK(pixel >= m_DestMin);
   return reinterpret_cast<const PixelWeight*>(
       &m_WeightTables[(pixel - m_DestMin) * m_ItemSize]);
 }
diff --git a/core/fxge/fx_font_unittest.cpp b/core/fxge/fx_font_unittest.cpp
index 5045fbe..107fa8e 100644
--- a/core/fxge/fx_font_unittest.cpp
+++ b/core/fxge/fx_font_unittest.cpp
@@ -10,6 +10,7 @@
 #include "core/fxge/fx_font.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/utils/path_service.h"
+#include "third_party/base/check.h"
 
 TEST(FXFontTest, PDF_UnicodeFromAdobeName) {
   EXPECT_EQ(static_cast<wchar_t>(0x0000), PDF_UnicodeFromAdobeName("nonesuch"));
@@ -35,7 +36,7 @@
 TEST(FXFontTest, ReadFontNameFromMicrosoftEntries) {
   std::string test_data_dir;
   PathService::GetTestDataDir(&test_data_dir);
-  ASSERT(!test_data_dir.empty());
+  DCHECK(!test_data_dir.empty());
 
   CFX_FontMapper font_mapper(nullptr);
 
diff --git a/core/fxge/fx_ge_linux.cpp b/core/fxge/fx_ge_linux.cpp
index d568813..bfd4375 100644
--- a/core/fxge/fx_ge_linux.cpp
+++ b/core/fxge/fx_ge_linux.cpp
@@ -14,6 +14,7 @@
 #include "core/fxge/cfx_gemodule.h"
 #include "core/fxge/fx_font.h"
 #include "core/fxge/systemfontinfo_iface.h"
+#include "third_party/base/check.h"
 #include "third_party/base/stl_util.h"
 
 #if !defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ASMJS)
@@ -105,7 +106,7 @@
   switch (charset) {
     case FX_CHARSET_ShiftJIS: {
       uint8_t index = GetJapanesePreference(family, weight, pitch_family);
-      ASSERT(index < pdfium::size(g_LinuxJpFontList));
+      DCHECK(index < pdfium::size(g_LinuxJpFontList));
       for (const char* name : g_LinuxJpFontList[index]) {
         auto it = m_FontList.find(name);
         if (it != m_FontList.end())
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index b61e7ec..cc975f2 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -147,7 +147,7 @@
         }
       }
     } else if (src_format == FXDIB_Format::kRgb32) {
-      ASSERT(dest_format == FXDIB_Format::kArgb);
+      DCHECK(dest_format == FXDIB_Format::kArgb);
       for (int row = 0; row < height; row++) {
         uint8_t* dest_scan = dest_buf + row * pitch;
         const uint8_t* src_scan =
@@ -278,13 +278,13 @@
 static void DebugValidate(const RetainPtr<CFX_DIBitmap>& bitmap,
                           const RetainPtr<CFX_DIBitmap>& device) {
   if (bitmap) {
-    ASSERT(bitmap->GetBPP() == 8 || bitmap->GetBPP() == 32);
+    DCHECK(bitmap->GetBPP() == 8 || bitmap->GetBPP() == 32);
     if (bitmap->GetBPP() == 32) {
       bitmap->DebugVerifyBitmapIsPreMultiplied(nullptr);
     }
   }
   if (device) {
-    ASSERT(device->GetBPP() == 8 || device->GetBPP() == 32);
+    DCHECK(device->GetBPP() == 8 || device->GetBPP() == 32);
     if (device->GetBPP() == 32) {
       device->DebugVerifyBitmapIsPreMultiplied(nullptr);
     }
@@ -312,7 +312,7 @@
   if (text_options.aliasing_type == CFX_TextRenderOptions::kAntiAliasing)
     return SkFont::Edging::kAntiAlias;
 
-  ASSERT(text_options.aliasing_type == CFX_TextRenderOptions::kLcd);
+  DCHECK(text_options.aliasing_type == CFX_TextRenderOptions::kLcd);
   return SkFont::Edging::kSubpixelAntiAlias;
 }
 
@@ -427,8 +427,8 @@
 }
 
 uint8_t FloatToByte(float f) {
-  ASSERT(f >= 0);
-  ASSERT(f <= 1);
+  DCHECK(f >= 0);
+  DCHECK(f <= 1);
   return (uint8_t)(f * 255.99f);
 }
 
@@ -1087,7 +1087,7 @@
     while (m_clipIndex > m_commandIndex) {
       do {
         --m_clipIndex;
-        ASSERT(m_clipIndex >= 0);
+        DCHECK(m_clipIndex >= 0);
       } while (m_commands[m_clipIndex] != Clip::kSave);
       m_pDriver->SkiaCanvas()->restore();
     }
@@ -1239,7 +1239,7 @@
     while (m_clipIndex > limit) {
       do {
         --m_clipIndex;
-        ASSERT(m_clipIndex >= 0);
+        DCHECK(m_clipIndex >= 0);
       } while (m_commands[m_clipIndex] != Clip::kSave);
       m_pDriver->SkiaCanvas()->restore();
     }
@@ -1247,7 +1247,7 @@
       if (Clip::kSave == m_commands[m_clipIndex]) {
         m_pDriver->SkiaCanvas()->save();
       } else {
-        ASSERT(Clip::kPath == m_commands[m_clipIndex]);
+        DCHECK(Clip::kPath == m_commands[m_clipIndex]);
         m_pDriver->SkiaCanvas()->clipPath(m_clips[m_clipIndex],
                                           SkClipOp::kIntersect, true);
       }
@@ -1337,10 +1337,10 @@
     DumpEndPrefix();
     int skCanvasSaveCount = m_pDriver->SkiaCanvas()->getSaveCount();
     int cacheSaveCount = 1;
-    ASSERT(m_clipIndex <= m_commands.count());
+    DCHECK(m_clipIndex <= m_commands.count());
     for (int index = 0; index < m_clipIndex; ++index)
       cacheSaveCount += Clip::kSave == m_commands[index];
-    ASSERT(skCanvasSaveCount == cacheSaveCount);
+    DCHECK(skCanvasSaveCount == cacheSaveCount);
 #endif  // SHOW_SKIA_PATH
   }
 
@@ -1397,7 +1397,7 @@
       return;
     int aggSaveCount = AggSaveCount(m_pDriver);
     int cacheSaveCount = CacheSaveCount(m_commands, m_commandIndex);
-    ASSERT(m_clipIndex <= m_commands.count());
+    DCHECK(m_clipIndex <= m_commands.count());
     if (aggSaveCount != cacheSaveCount) {
       // may not signify a bug if counts don't match
       printf("aggSaveCount %d != cacheSaveCount %d\n", aggSaveCount,
@@ -1501,11 +1501,11 @@
       m_fontCharWidths[index] = width;
     }
     int Count() const {
-      ASSERT(m_positions.count() == m_glyphs.count());
+      DCHECK(m_positions.count() == m_glyphs.count());
       return m_glyphs.count();
     }
     void SetCount(int count) {
-      ASSERT(count >= 0);
+      DCHECK(count >= 0);
       m_positions.setCount(count);
       m_glyphs.setCount(count);
       m_fontCharWidths.setCount(count);
@@ -1644,7 +1644,7 @@
                      ? kAlpha_8_SkColorType
                      : kGray_8_SkColorType;
   } else {
-    ASSERT(bpp == 32);
+    DCHECK(bpp == 32);
     color_type = Get32BitSkColorType(bRgbByteOrder);
   }
 
@@ -2280,7 +2280,7 @@
     skPath.addRect(skRect);
     skPath.transform(inverse);
   } else {
-    ASSERT(kCoonsPatchMeshShading == shadingType);
+    DCHECK(kCoonsPatchMeshShading == shadingType);
     const CPDF_Stream* pStream = ToStream(pPattern->GetShadingObject());
     if (!pStream)
       return false;
@@ -2375,7 +2375,7 @@
   SkBitmap skSrcBitmap;
   skSrcBitmap.installPixels(srcImageInfo, srcBuffer, srcRowBytes);
   uint8_t* dstBuffer = pBitmap->GetBuffer();
-  ASSERT(dstBuffer);
+  DCHECK(dstBuffer);
   int dstWidth = pBitmap->GetWidth();
   int dstHeight = pBitmap->GetHeight();
   size_t dstRowBytes = pBitmap->GetPitch();
@@ -2802,7 +2802,7 @@
 
 void CFX_DIBBase::DebugVerifyBitmapIsPreMultiplied(void* opt) const {
 #ifdef SK_DEBUG
-  ASSERT(GetBPP() == 32);
+  DCHECK(GetBPP() == 32);
   const uint32_t* buffer = (const uint32_t*)(opt ? opt : GetBuffer());
   int width = GetWidth();
   int height = GetHeight();
@@ -2815,9 +2815,9 @@
       uint8_t g = SkGetPackedG32(srcRow[x]);
       uint8_t b = SkGetPackedB32(srcRow[x]);
       SkA32Assert(a);
-      ASSERT(r <= a);
-      ASSERT(g <= a);
-      ASSERT(b <= a);
+      DCHECK(r <= a);
+      DCHECK(g <= a);
+      DCHECK(b <= a);
     }
   }
 #endif  // SK_DEBUG
diff --git a/core/fxge/win32/cgdi_device_driver.cpp b/core/fxge/win32/cgdi_device_driver.cpp
index 57c127a..4264449 100644
--- a/core/fxge/win32/cgdi_device_driver.cpp
+++ b/core/fxge/win32/cgdi_device_driver.cpp
@@ -18,6 +18,7 @@
 #include "core/fxge/dib/cfx_dibitmap.h"
 #include "core/fxge/render_defines.h"
 #include "core/fxge/win32/cwin32_platform.h"
+#include "third_party/base/check.h"
 #include "third_party/base/notreached.h"
 
 #if !defined(_SKIA_SUPPORT_)
@@ -42,7 +43,7 @@
 HPEN CreateExtPen(const CFX_GraphStateData* pGraphState,
                   const CFX_Matrix* pMatrix,
                   uint32_t argb) {
-  ASSERT(pGraphState);
+  DCHECK(pGraphState);
 
   float scale = 1.0f;
   if (pMatrix) {
@@ -523,7 +524,7 @@
         x2 = x[0];
         y2 = y[0];
       } else {
-        ASSERT(np == 2);
+        DCHECK(np == 2);
         x1 = x[0];
         y1 = y[0];
         x2 = x[1];
diff --git a/core/fxge/win32/cgdi_display_driver.cpp b/core/fxge/win32/cgdi_display_driver.cpp
index 127cf0d..9d80b40 100644
--- a/core/fxge/win32/cgdi_display_driver.cpp
+++ b/core/fxge/win32/cgdi_display_driver.cpp
@@ -12,6 +12,7 @@
 #include "core/fxge/dib/cfx_dibitmap.h"
 #include "core/fxge/render_defines.h"
 #include "core/fxge/win32/cwin32_platform.h"
+#include "third_party/base/check.h"
 
 CGdiDisplayDriver::CGdiDisplayDriver(HDC hDC)
     : CGdiDeviceDriver(hDC, DeviceType::kDisplay) {
@@ -76,7 +77,7 @@
                                   int left,
                                   int top,
                                   BlendMode blend_type) {
-  ASSERT(blend_type == BlendMode::kNormal);
+  DCHECK(blend_type == BlendMode::kNormal);
   if (pSource->IsMask()) {
     int width = pSource->GetWidth(), height = pSource->GetHeight();
     int alpha = FXARGB_A(color);
@@ -155,8 +156,8 @@
                                       const FX_RECT* pClipRect,
                                       const FXDIB_ResampleOptions& options,
                                       BlendMode blend_type) {
-  ASSERT(pSource);
-  ASSERT(pClipRect);
+  DCHECK(pSource);
+  DCHECK(pClipRect);
 
   if (options.HasAnyOptions() || dest_width > 10000 || dest_width < -10000 ||
       dest_height > 10000 || dest_height < -10000) {
diff --git a/core/fxge/win32/cgdi_printer_driver.cpp b/core/fxge/win32/cgdi_printer_driver.cpp
index d027140..4fd73d0 100644
--- a/core/fxge/win32/cgdi_printer_driver.cpp
+++ b/core/fxge/win32/cgdi_printer_driver.cpp
@@ -20,6 +20,7 @@
 #include "core/fxge/dib/cfx_dibitmap.h"
 #include "core/fxge/render_defines.h"
 #include "core/fxge/text_char_pos.h"
+#include "third_party/base/check.h"
 
 #if defined(PDFIUM_PRINT_TEXT_WITH_GDI)
 namespace {
@@ -83,9 +84,9 @@
                          pSource->GetHeight(), &clip_rect,
                          FXDIB_ResampleOptions(), BlendMode::kNormal);
   }
-  ASSERT(pSource);
-  ASSERT(!pSource->IsMask());
-  ASSERT(blend_type == BlendMode::kNormal);
+  DCHECK(pSource);
+  DCHECK(!pSource->IsMask());
+  DCHECK(blend_type == BlendMode::kNormal);
   if (pSource->HasAlpha())
     return false;
 
@@ -296,11 +297,11 @@
     // Only works with PDFs from Skia's PDF generator. Cannot handle arbitrary
     // values from PDFs.
     const TextCharPos& charpos = pCharPos[i];
-    ASSERT(charpos.m_AdjustMatrix[0] == 0);
-    ASSERT(charpos.m_AdjustMatrix[1] == 0);
-    ASSERT(charpos.m_AdjustMatrix[2] == 0);
-    ASSERT(charpos.m_AdjustMatrix[3] == 0);
-    ASSERT(charpos.m_Origin.y == 0);
+    DCHECK(charpos.m_AdjustMatrix[0] == 0);
+    DCHECK(charpos.m_AdjustMatrix[1] == 0);
+    DCHECK(charpos.m_AdjustMatrix[2] == 0);
+    DCHECK(charpos.m_AdjustMatrix[3] == 0);
+    DCHECK(charpos.m_Origin.y == 0);
 
     // Round the spacing to the nearest integer, but keep track of the rounding
     // error for calculating the next spacing value.
diff --git a/core/fxge/win32/cps_printer_driver.cpp b/core/fxge/win32/cps_printer_driver.cpp
index d5e562a..389bcb3 100644
--- a/core/fxge/win32/cps_printer_driver.cpp
+++ b/core/fxge/win32/cps_printer_driver.cpp
@@ -16,6 +16,7 @@
 #include "core/fxge/cfx_pathdata.h"
 #include "core/fxge/dib/cfx_imagerenderer.h"
 #include "core/fxge/win32/cpsoutput.h"
+#include "third_party/base/check.h"
 #include "third_party/base/notreached.h"
 
 CPSPrinterDriver::CPSPrinterDriver(HDC hDC,
@@ -23,7 +24,7 @@
                                    const EncoderIface* pEncoderIface)
     : m_hDC(hDC), m_PSRenderer(pEncoderIface) {
   // |mode| should be PostScript.
-  ASSERT(mode == WindowsPrintMode::kModePostScript2 ||
+  DCHECK(mode == WindowsPrintMode::kModePostScript2 ||
          mode == WindowsPrintMode::kModePostScript3 ||
          mode == WindowsPrintMode::kModePostScript2PassThrough ||
          mode == WindowsPrintMode::kModePostScript3PassThrough);
diff --git a/core/fxge/win32/ctext_only_printer_driver.cpp b/core/fxge/win32/ctext_only_printer_driver.cpp
index ef6ec80..fed5d5e 100644
--- a/core/fxge/win32/ctext_only_printer_driver.cpp
+++ b/core/fxge/win32/ctext_only_printer_driver.cpp
@@ -15,6 +15,7 @@
 #include "core/fxcrt/fx_system.h"
 #include "core/fxge/cfx_font.h"
 #include "core/fxge/text_char_pos.h"
+#include "third_party/base/check.h"
 #include "third_party/base/notreached.h"
 
 CTextOnlyPrinterDriver::CTextOnlyPrinterDriver(HDC hDC)
@@ -156,11 +157,11 @@
     // Only works with PDFs from Skia's PDF generator. Cannot handle arbitrary
     // values from PDFs.
     const TextCharPos& charpos = pCharPos[i];
-    ASSERT(charpos.m_AdjustMatrix[0] == 0);
-    ASSERT(charpos.m_AdjustMatrix[1] == 0);
-    ASSERT(charpos.m_AdjustMatrix[2] == 0);
-    ASSERT(charpos.m_AdjustMatrix[3] == 0);
-    ASSERT(charpos.m_Origin.y == 0);
+    DCHECK(charpos.m_AdjustMatrix[0] == 0);
+    DCHECK(charpos.m_AdjustMatrix[1] == 0);
+    DCHECK(charpos.m_AdjustMatrix[2] == 0);
+    DCHECK(charpos.m_AdjustMatrix[3] == 0);
+    DCHECK(charpos.m_Origin.y == 0);
 
     wsText += charpos.m_Unicode;
   }