Split fx_font into multiple files, part 1.

Moved classes CFX_FontCache and CFX_AutoFontCache into a separate file.

Review-Url: https://codereview.chromium.org/2246223002
diff --git a/BUILD.gn b/BUILD.gn
index b020ab2..7f49b16 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -750,10 +750,12 @@
     "core/fxge/fontdata/chromefontdata/FoxitSymbol.cpp",
     "core/fxge/fontdata/chromefontdata/chromefontdata.h",
     "core/fxge/freetype/fx_freetype.cpp",
+    "core/fxge/ge/cfx_autofontcache.cpp",
     "core/fxge/ge/cfx_cliprgn.cpp",
     "core/fxge/ge/cfx_cliprgn.h",
     "core/fxge/ge/cfx_folderfontinfo.cpp",
     "core/fxge/ge/cfx_folderfontinfo.h",
+    "core/fxge/ge/cfx_fontcache.cpp",
     "core/fxge/ge/cfx_fontmapper.cpp",
     "core/fxge/ge/cfx_fontmgr.cpp",
     "core/fxge/ge/cfx_gemodule.cpp",
@@ -769,6 +771,8 @@
     "core/fxge/ge/include/cfx_fontmgr.h",
     "core/fxge/ge/include/ifx_systemfontinfo.h",
     "core/fxge/ifx_renderdevicedriver.cpp",
+    "core/fxge/include/cfx_autofontcache.h",
+    "core/fxge/include/cfx_fontcache.h",
     "core/fxge/include/cfx_fxgedevice.h",
     "core/fxge/include/cfx_gemodule.h",
     "core/fxge/include/cfx_graphstatedata.h",
diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
index 1f04373..0274f10 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
@@ -21,6 +21,7 @@
 #include "core/fpdfapi/fpdf_render/render_int.h"
 #include "core/fpdfapi/include/cpdf_modulemgr.h"
 #include "core/fxcodec/include/JBig2_DocumentContext.h"
+#include "core/fxge/include/cfx_fontcache.h"
 #include "core/fxge/include/fx_font.h"
 #include "third_party/base/stl_util.h"
 
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index b736a1f..576be6a 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -30,6 +30,7 @@
 #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h"
 #include "core/fpdfapi/include/cpdf_modulemgr.h"
 #include "core/fpdfdoc/include/cpdf_occontext.h"
+#include "core/fxge/include/cfx_fontcache.h"
 #include "core/fxge/include/cfx_fxgedevice.h"
 #include "core/fxge/include/cfx_graphstatedata.h"
 #include "core/fxge/include/cfx_pathdata.h"
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
index 222fbcb..549e592 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -22,6 +22,8 @@
 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h"
 #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h"
+#include "core/fxge/include/cfx_autofontcache.h"
+#include "core/fxge/include/cfx_fontcache.h"
 #include "core/fxge/include/cfx_fxgedevice.h"
 #include "core/fxge/include/cfx_gemodule.h"
 #include "core/fxge/include/cfx_graphstatedata.h"
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index c9f8bb4..cf0fd909 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -13,6 +13,7 @@
 #include "core/fxge/dib/dib_int.h"
 #include "core/fxge/ge/cfx_cliprgn.h"
 #include "core/fxge/ge/fx_text_int.h"
+#include "core/fxge/include/cfx_fontcache.h"
 #include "core/fxge/include/cfx_fxgedevice.h"
 #include "core/fxge/include/cfx_gemodule.h"
 #include "core/fxge/include/cfx_graphstatedata.h"
diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h
index 8d6aec1..db6807c 100644
--- a/core/fxge/agg/fx_agg_driver.h
+++ b/core/fxge/agg/fx_agg_driver.h
@@ -16,6 +16,7 @@
 #include "third_party/agg23/agg_rasterizer_scanline_aa.h"
 
 class CFX_ClipRgn;
+class CFX_FontCache;
 class CFX_GraphStateData;
 class CFX_Matrix;
 class CFX_PathData;
diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h
index b81f783..a401086 100644
--- a/core/fxge/apple/apple_int.h
+++ b/core/fxge/apple/apple_int.h
@@ -21,6 +21,8 @@
 #include <Carbon/Carbon.h>
 #endif
 
+class CFX_FontCache;
+
 class CQuartz2D {
  public:
   void* createGraphics(CFX_DIBitmap* bitmap);
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp
index c02e8ae..fed24cf 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -17,6 +17,7 @@
 #include "core/fxge/dib/dib_int.h"
 #include "core/fxge/ge/cfx_cliprgn.h"
 #include "core/fxge/ge/fx_text_int.h"
+#include "core/fxge/include/cfx_fontcache.h"
 #include "core/fxge/include/cfx_gemodule.h"
 #include "core/fxge/include/cfx_renderdevice.h"
 #include "core/fxge/include/fx_freetype.h"
diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp
index c877715..400e290 100644
--- a/core/fxge/apple/fx_quartz_device.cpp
+++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -13,6 +13,7 @@
 #include "core/fxcrt/include/fx_memory.h"
 #include "core/fxge/dib/dib_int.h"
 #include "core/fxge/ge/fx_text_int.h"
+#include "core/fxge/include/cfx_fontcache.h"
 #include "core/fxge/include/cfx_gemodule.h"
 #include "core/fxge/include/cfx_graphstatedata.h"
 #include "core/fxge/include/cfx_pathdata.h"
diff --git a/core/fxge/ge/cfx_autofontcache.cpp b/core/fxge/ge/cfx_autofontcache.cpp
new file mode 100644
index 0000000..871f207
--- /dev/null
+++ b/core/fxge/ge/cfx_autofontcache.cpp
@@ -0,0 +1,17 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/include/cfx_autofontcache.h"
+
+#include "core/fxge/include/cfx_fontcache.h"
+#include "core/fxge/include/fx_font.h"
+
+CFX_AutoFontCache::CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont)
+    : m_pFontCache(pFontCache), m_pFont(pFont) {}
+
+CFX_AutoFontCache::~CFX_AutoFontCache() {
+  m_pFontCache->ReleaseCachedFace(m_pFont);
+}
diff --git a/core/fxge/ge/cfx_fontcache.cpp b/core/fxge/ge/cfx_fontcache.cpp
new file mode 100644
index 0000000..a183711
--- /dev/null
+++ b/core/fxge/ge/cfx_fontcache.cpp
@@ -0,0 +1,78 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/include/cfx_fontcache.h"
+
+#include "core/fxge/include/fx_font.h"
+#include "core/fxge/include/fx_freetype.h"
+
+CFX_FontCache::CFX_FontCache() {}
+
+CFX_FontCache::~CFX_FontCache() {
+  FreeCache(TRUE);
+}
+
+CFX_FaceCache* CFX_FontCache::GetCachedFace(CFX_Font* pFont) {
+  FXFT_Face face = pFont->GetFace();
+  const bool bExternal = !face;
+  CFX_FTCacheMap& map = bExternal ? m_ExtFaceMap : m_FTFaceMap;
+  auto it = map.find(face);
+  if (it != map.end()) {
+    CFX_CountedFaceCache* counted_face_cache = it->second;
+    counted_face_cache->m_nCount++;
+    return counted_face_cache->m_Obj;
+  }
+
+  CFX_FaceCache* face_cache = new CFX_FaceCache(bExternal ? nullptr : face);
+  CFX_CountedFaceCache* counted_face_cache = new CFX_CountedFaceCache;
+  counted_face_cache->m_nCount = 2;
+  counted_face_cache->m_Obj = face_cache;
+  map[face] = counted_face_cache;
+  return face_cache;
+}
+
+#ifdef _SKIA_SUPPORT_
+CFX_TypeFace* CFX_FontCache::GetDeviceCache(CFX_Font* pFont) {
+  return GetCachedFace(pFont)->GetDeviceCache(pFont);
+}
+#endif
+
+void CFX_FontCache::ReleaseCachedFace(CFX_Font* pFont) {
+  FXFT_Face face = pFont->GetFace();
+  const bool bExternal = !face;
+  CFX_FTCacheMap& map = bExternal ? m_ExtFaceMap : m_FTFaceMap;
+
+  auto it = map.find(face);
+  if (it == map.end())
+    return;
+
+  CFX_CountedFaceCache* counted_face_cache = it->second;
+  if (counted_face_cache->m_nCount > 1) {
+    counted_face_cache->m_nCount--;
+  }
+}
+
+void CFX_FontCache::FreeCache(FX_BOOL bRelease) {
+  for (auto it = m_FTFaceMap.begin(); it != m_FTFaceMap.end();) {
+    auto curr_it = it++;
+    CFX_CountedFaceCache* cache = curr_it->second;
+    if (bRelease || cache->m_nCount < 2) {
+      delete cache->m_Obj;
+      delete cache;
+      m_FTFaceMap.erase(curr_it);
+    }
+  }
+
+  for (auto it = m_ExtFaceMap.begin(); it != m_ExtFaceMap.end();) {
+    auto curr_it = it++;
+    CFX_CountedFaceCache* cache = curr_it->second;
+    if (bRelease || cache->m_nCount < 2) {
+      delete cache->m_Obj;
+      delete cache;
+      m_ExtFaceMap.erase(curr_it);
+    }
+  }
+}
diff --git a/core/fxge/ge/cfx_gemodule.cpp b/core/fxge/ge/cfx_gemodule.cpp
index 73189b7..4eb4094 100644
--- a/core/fxge/ge/cfx_gemodule.cpp
+++ b/core/fxge/ge/cfx_gemodule.cpp
@@ -8,6 +8,7 @@
 
 #include "core/fxge/ge/cfx_folderfontinfo.h"
 #include "core/fxge/ge/fx_text_int.h"
+#include "core/fxge/include/cfx_fontcache.h"
 #include "core/fxge/include/cfx_fontmgr.h"
 
 namespace {
diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp
index fcb99f7..1890b52 100644
--- a/core/fxge/ge/cfx_renderdevice.cpp
+++ b/core/fxge/ge/cfx_renderdevice.cpp
@@ -7,6 +7,8 @@
 #include "core/fxge/include/cfx_renderdevice.h"
 
 #include "core/fxcrt/include/fx_safe_types.h"
+#include "core/fxge/include/cfx_autofontcache.h"
+#include "core/fxge/include/cfx_fontcache.h"
 #include "core/fxge/include/cfx_fxgedevice.h"
 #include "core/fxge/include/cfx_graphstatedata.h"
 #include "core/fxge/include/cfx_pathdata.h"
diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp
index 9ed751b..8e16c17 100644
--- a/core/fxge/ge/fx_ge_text.cpp
+++ b/core/fxge/ge/fx_ge_text.cpp
@@ -106,36 +106,7 @@
   return rect;
 }
 
-CFX_FontCache::CFX_FontCache() {}
-
-CFX_FontCache::~CFX_FontCache() {
-  FreeCache(TRUE);
-}
-
-CFX_FaceCache* CFX_FontCache::GetCachedFace(CFX_Font* pFont) {
-  FXFT_Face face = pFont->GetFace();
-  const bool bExternal = !face;
-  CFX_FTCacheMap& map = bExternal ? m_ExtFaceMap : m_FTFaceMap;
-  auto it = map.find(face);
-  if (it != map.end()) {
-    CFX_CountedFaceCache* counted_face_cache = it->second;
-    counted_face_cache->m_nCount++;
-    return counted_face_cache->m_Obj;
-  }
-
-  CFX_FaceCache* face_cache = new CFX_FaceCache(bExternal ? nullptr : face);
-  CFX_CountedFaceCache* counted_face_cache = new CFX_CountedFaceCache;
-  counted_face_cache->m_nCount = 2;
-  counted_face_cache->m_Obj = face_cache;
-  map[face] = counted_face_cache;
-  return face_cache;
-}
-
 #ifdef _SKIA_SUPPORT_
-CFX_TypeFace* CFX_FontCache::GetDeviceCache(CFX_Font* pFont) {
-  return GetCachedFace(pFont)->GetDeviceCache(pFont);
-}
-
 CFX_TypeFace* CFX_FaceCache::GetDeviceCache(CFX_Font* pFont) {
   if (!m_pTypeface) {
     m_pTypeface =
@@ -147,43 +118,6 @@
 }
 #endif
 
-void CFX_FontCache::ReleaseCachedFace(CFX_Font* pFont) {
-  FXFT_Face face = pFont->GetFace();
-  const bool bExternal = !face;
-  CFX_FTCacheMap& map = bExternal ? m_ExtFaceMap : m_FTFaceMap;
-
-  auto it = map.find(face);
-  if (it == map.end())
-    return;
-
-  CFX_CountedFaceCache* counted_face_cache = it->second;
-  if (counted_face_cache->m_nCount > 1) {
-    counted_face_cache->m_nCount--;
-  }
-}
-
-void CFX_FontCache::FreeCache(FX_BOOL bRelease) {
-  for (auto it = m_FTFaceMap.begin(); it != m_FTFaceMap.end();) {
-    auto curr_it = it++;
-    CFX_CountedFaceCache* cache = curr_it->second;
-    if (bRelease || cache->m_nCount < 2) {
-      delete cache->m_Obj;
-      delete cache;
-      m_FTFaceMap.erase(curr_it);
-    }
-  }
-
-  for (auto it = m_ExtFaceMap.begin(); it != m_ExtFaceMap.end();) {
-    auto curr_it = it++;
-    CFX_CountedFaceCache* cache = curr_it->second;
-    if (bRelease || cache->m_nCount < 2) {
-      delete cache->m_Obj;
-      delete cache;
-      m_ExtFaceMap.erase(curr_it);
-    }
-  }
-}
-
 CFX_FaceCache::CFX_FaceCache(FXFT_Face face)
     : m_Face(face)
 #ifdef _SKIA_SUPPORT_
diff --git a/core/fxge/ifx_renderdevicedriver.cpp b/core/fxge/ifx_renderdevicedriver.cpp
index 25c3a4a..69b8ac9 100644
--- a/core/fxge/ifx_renderdevicedriver.cpp
+++ b/core/fxge/ifx_renderdevicedriver.cpp
@@ -10,6 +10,8 @@
 #include "core/fxge/include/cfx_pathdata.h"
 #include "core/fxge/include/cfx_renderdevice.h"
 
+class CFX_FontCache;
+
 IFX_RenderDeviceDriver::~IFX_RenderDeviceDriver() {}
 
 CFX_Matrix IFX_RenderDeviceDriver::GetCTM() const {
diff --git a/core/fxge/include/cfx_autofontcache.h b/core/fxge/include/cfx_autofontcache.h
new file mode 100644
index 0000000..c1ef079
--- /dev/null
+++ b/core/fxge/include/cfx_autofontcache.h
@@ -0,0 +1,23 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_INCLUDE_CFX_AUTOFONTCACHE_H_
+#define CORE_FXGE_INCLUDE_CFX_AUTOFONTCACHE_H_
+
+#include "core/fxge/include/cfx_fontcache.h"
+#include "core/fxge/include/fx_font.h"
+
+class CFX_AutoFontCache {
+ public:
+  CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont);
+  ~CFX_AutoFontCache();
+
+ private:
+  CFX_FontCache* m_pFontCache;
+  CFX_Font* m_pFont;
+};
+
+#endif  // CORE_FXGE_INCLUDE_CFX_AUTOFONTCACHE_H_
diff --git a/core/fxge/include/cfx_fontcache.h b/core/fxge/include/cfx_fontcache.h
new file mode 100644
index 0000000..3aee207
--- /dev/null
+++ b/core/fxge/include/cfx_fontcache.h
@@ -0,0 +1,33 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_INCLUDE_CFX_FONTCACHE_H_
+#define CORE_FXGE_INCLUDE_CFX_FONTCACHE_H_
+
+#include <map>
+
+#include "core/fxcrt/include/fx_system.h"
+#include "core/fxge/include/fx_font.h"
+#include "core/fxge/include/fx_freetype.h"
+
+class CFX_FontCache {
+ public:
+  CFX_FontCache();
+  ~CFX_FontCache();
+  CFX_FaceCache* GetCachedFace(CFX_Font* pFont);
+  void ReleaseCachedFace(CFX_Font* pFont);
+  void FreeCache(FX_BOOL bRelease = FALSE);
+#ifdef _SKIA_SUPPORT_
+  CFX_TypeFace* GetDeviceCache(CFX_Font* pFont);
+#endif
+
+ private:
+  using CFX_FTCacheMap = std::map<FXFT_Face, CFX_CountedFaceCache*>;
+  CFX_FTCacheMap m_FTFaceMap;
+  CFX_FTCacheMap m_ExtFaceMap;
+};
+
+#endif  // CORE_FXGE_INCLUDE_CFX_FONTCACHE_H_
diff --git a/core/fxge/include/fx_font.h b/core/fxge/include/fx_font.h
index 8c79281..bb7632d 100644
--- a/core/fxge/include/fx_font.h
+++ b/core/fxge/include/fx_font.h
@@ -19,6 +19,7 @@
 typedef void* FXFT_Library;
 
 class CFX_FaceCache;
+class CFX_FontCache;
 class CFX_PathData;
 class CFX_SizeGlyphCache;
 class CFX_SubstFont;
@@ -289,32 +290,6 @@
   uint32_t m_nCount;
 };
 
-class CFX_FontCache {
- public:
-  CFX_FontCache();
-  ~CFX_FontCache();
-  CFX_FaceCache* GetCachedFace(CFX_Font* pFont);
-  void ReleaseCachedFace(CFX_Font* pFont);
-  void FreeCache(FX_BOOL bRelease = FALSE);
-#ifdef _SKIA_SUPPORT_
-  CFX_TypeFace* GetDeviceCache(CFX_Font* pFont);
-#endif
-
- private:
-  using CFX_FTCacheMap = std::map<FXFT_Face, CFX_CountedFaceCache*>;
-  CFX_FTCacheMap m_FTFaceMap;
-  CFX_FTCacheMap m_ExtFaceMap;
-};
-
-class CFX_AutoFontCache {
- public:
-  CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont)
-      : m_pFontCache(pFontCache), m_pFont(pFont) {}
-  ~CFX_AutoFontCache() { m_pFontCache->ReleaseCachedFace(m_pFont); }
-  CFX_FontCache* m_pFontCache;
-  CFX_Font* m_pFont;
-};
-
 class CFX_GlyphBitmap {
  public:
   int m_Top;
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 32e90e1..fd4f739 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -14,6 +14,7 @@
 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h"
+#include "core/fxge/include/cfx_fontcache.h"
 #include "core/fxge/include/cfx_fxgedevice.h"
 #include "core/fxge/include/cfx_gemodule.h"
 #include "core/fxge/include/cfx_graphstatedata.h"
diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h
index 6e112f5..8a1bf69 100644
--- a/core/fxge/skia/fx_skia_device.h
+++ b/core/fxge/skia/fx_skia_device.h
@@ -10,6 +10,7 @@
 #include "core/fxge/include/cfx_pathdata.h"
 #include "core/fxge/include/ifx_renderdevicedriver.h"
 
+class CFX_FontCache;
 class SkCanvas;
 class SkMatrix;
 class SkPaint;
diff --git a/core/fxge/skia/fx_skia_device_unittest.cpp b/core/fxge/skia/fx_skia_device_unittest.cpp
index 456bea0..77d6576 100644
--- a/core/fxge/skia/fx_skia_device_unittest.cpp
+++ b/core/fxge/skia/fx_skia_device_unittest.cpp
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "core/fxge/include/cfx_fontcache.h"
 #include "core/fxge/include/cfx_fxgedevice.h"
 #include "core/fxge/include/cfx_graphstatedata.h"
 #include "core/fxge/include/cfx_pathdata.h"
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index 207ff24..6b9c2cc 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -15,6 +15,7 @@
 #include "core/fxge/dib/dib_int.h"
 #include "core/fxge/ge/fx_text_int.h"
 #include "core/fxge/include/fx_freetype.h"
+#include "core/fxge/include/cfx_fontcache.h"
 #include "core/fxge/include/cfx_renderdevice.h"
 #include "core/fxge/include/cfx_windowsdevice.h"
 #include "core/fxge/win32/win32_int.h"
diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h
index 094e3ef..8c3443b 100644
--- a/core/fxge/win32/win32_int.h
+++ b/core/fxge/win32/win32_int.h
@@ -11,6 +11,7 @@
 #include "core/fxge/include/ifx_renderdevicedriver.h"
 #include "core/fxge/win32/dwrite_int.h"
 
+class CFX_FontCache;
 struct FXTEXT_CHARPOS;
 struct WINDIB_Open_Args_;
 
diff --git a/pdfium.gyp b/pdfium.gyp
index 329764f..d834394 100644
--- a/pdfium.gyp
+++ b/pdfium.gyp
@@ -734,10 +734,12 @@
         'core/fxge/fontdata/chromefontdata/FoxitSerifMM.cpp',
         'core/fxge/fontdata/chromefontdata/FoxitSymbol.cpp',
         'core/fxge/freetype/fx_freetype.cpp',
+        'core/fxge/ge/cfx_autofontcache.cpp',
         'core/fxge/ge/cfx_cliprgn.cpp',
         'core/fxge/ge/cfx_cliprgn.h',
         'core/fxge/ge/cfx_folderfontinfo.cpp',
         'core/fxge/ge/cfx_folderfontinfo.h',
+        'core/fxge/ge/cfx_fontcache.cpp',
         'core/fxge/ge/cfx_fontmapper.cpp',
         'core/fxge/ge/cfx_fontmgr.cpp',
         'core/fxge/ge/cfx_gemodule.cpp',
@@ -753,6 +755,8 @@
         'core/fxge/ge/fx_ge_text.cpp',
         'core/fxge/ge/fx_text_int.h',
         'core/fxge/ifx_renderdevicedriver.cpp',
+        'core/fxge/include/cfx_autofontcache.h',
+        'core/fxge/include/cfx_fontcache.h',
         'core/fxge/include/cfx_fxgedevice.h',
         'core/fxge/include/cfx_gemodule.h',
         'core/fxge/include/cfx_graphstatedata.h',
diff --git a/xfa/fde/fde_gedevice.cpp b/xfa/fde/fde_gedevice.cpp
index 2579365..778eb73 100644
--- a/xfa/fde/fde_gedevice.cpp
+++ b/xfa/fde/fde_gedevice.cpp
@@ -8,6 +8,7 @@
 
 #include <algorithm>
 
+#include "core/fxge/include/cfx_fontcache.h"
 #include "core/fxge/include/cfx_gemodule.h"
 #include "core/fxge/include/cfx_graphstatedata.h"
 #include "core/fxge/include/cfx_renderdevice.h"