Forward declare more in codec code.

Change-Id: I8060ada299f845a9198a6e83d31d128bd4bf09bc
Reviewed-on: https://pdfium-review.googlesource.com/c/43870
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcodec/bmp/cfx_bmpdecompressor.cpp b/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
index b99a11c..000a9e2 100644
--- a/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
+++ b/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
@@ -11,6 +11,7 @@
 #include <utility>
 
 #include "core/fxcodec/bmp/cfx_bmpcontext.h"
+#include "core/fxcodec/codec/cfx_codec_memory.h"
 #include "core/fxcrt/fx_safe_types.h"
 #include "core/fxcrt/fx_system.h"
 #include "third_party/base/logging.h"
diff --git a/core/fxcodec/bmp/cfx_bmpdecompressor.h b/core/fxcodec/bmp/cfx_bmpdecompressor.h
index 53d52ae..ebab9ea 100644
--- a/core/fxcodec/bmp/cfx_bmpdecompressor.h
+++ b/core/fxcodec/bmp/cfx_bmpdecompressor.h
@@ -12,10 +12,10 @@
 #include <vector>
 
 #include "core/fxcodec/bmp/fx_bmp.h"
-#include "core/fxcodec/codec/cfx_codec_memory.h"
 #include "third_party/base/span.h"
 
 class CFX_BmpContext;
+class CFX_CodecMemory;
 
 class CFX_BmpDecompressor {
  public:
diff --git a/core/fxcodec/codec/ccodec_bmpmodule.cpp b/core/fxcodec/codec/ccodec_bmpmodule.cpp
index 359dbc1..9d03218 100644
--- a/core/fxcodec/codec/ccodec_bmpmodule.cpp
+++ b/core/fxcodec/codec/ccodec_bmpmodule.cpp
@@ -9,6 +9,7 @@
 #include <utility>
 
 #include "core/fxcodec/bmp/cfx_bmpcontext.h"
+#include "core/fxcodec/codec/cfx_codec_memory.h"
 #include "core/fxcodec/codec/codec_int.h"
 #include "core/fxcodec/fx_codec.h"
 #include "core/fxge/fx_dib.h"
diff --git a/core/fxcodec/codec/ccodec_bmpmodule.h b/core/fxcodec/codec/ccodec_bmpmodule.h
index 7a56088..0948b06 100644
--- a/core/fxcodec/codec/ccodec_bmpmodule.h
+++ b/core/fxcodec/codec/ccodec_bmpmodule.h
@@ -11,8 +11,6 @@
 #include <vector>
 
 #include "core/fxcodec/codec/codec_module_iface.h"
-#include "core/fxcrt/fx_system.h"
-#include "third_party/base/span.h"
 
 class CFX_DIBAttribute;
 
diff --git a/core/fxcodec/codec/ccodec_gifmodule.cpp b/core/fxcodec/codec/ccodec_gifmodule.cpp
index 4162171..fb81c05 100644
--- a/core/fxcodec/codec/ccodec_gifmodule.cpp
+++ b/core/fxcodec/codec/ccodec_gifmodule.cpp
@@ -6,6 +6,7 @@
 
 #include "core/fxcodec/codec/ccodec_gifmodule.h"
 
+#include "core/fxcodec/codec/cfx_codec_memory.h"
 #include "core/fxcodec/codec/codec_int.h"
 #include "core/fxcodec/fx_codec.h"
 #include "core/fxcodec/gif/cfx_gif.h"
diff --git a/core/fxcodec/codec/ccodec_gifmodule.h b/core/fxcodec/codec/ccodec_gifmodule.h
index 0e85998..e044aa4 100644
--- a/core/fxcodec/codec/ccodec_gifmodule.h
+++ b/core/fxcodec/codec/ccodec_gifmodule.h
@@ -13,8 +13,6 @@
 #include "core/fxcodec/codec/codec_module_iface.h"
 #include "core/fxcodec/gif/cfx_gif.h"
 #include "core/fxcrt/fx_coordinates.h"
-#include "core/fxcrt/fx_system.h"
-#include "third_party/base/span.h"
 
 class CFX_DIBAttribute;
 
diff --git a/core/fxcodec/codec/ccodec_jpegmodule.cpp b/core/fxcodec/codec/ccodec_jpegmodule.cpp
index 4a6059a..2ba04bb 100644
--- a/core/fxcodec/codec/ccodec_jpegmodule.cpp
+++ b/core/fxcodec/codec/ccodec_jpegmodule.cpp
@@ -12,6 +12,7 @@
 #include <utility>
 
 #include "core/fxcodec/codec/ccodec_scanlinedecoder.h"
+#include "core/fxcodec/codec/cfx_codec_memory.h"
 #include "core/fxcodec/fx_codec.h"
 #include "core/fxcrt/fx_memory.h"
 #include "core/fxcrt/fx_safe_types.h"
diff --git a/core/fxcodec/codec/ccodec_jpegmodule.h b/core/fxcodec/codec/ccodec_jpegmodule.h
index 258038f..98c94e3 100644
--- a/core/fxcodec/codec/ccodec_jpegmodule.h
+++ b/core/fxcodec/codec/ccodec_jpegmodule.h
@@ -11,8 +11,6 @@
 #include <memory>
 
 #include "core/fxcodec/codec/codec_module_iface.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxcrt/retain_ptr.h"
 #include "third_party/base/span.h"
 
 class CCodec_ScanlineDecoder;
diff --git a/core/fxcodec/codec/ccodec_pngmodule.cpp b/core/fxcodec/codec/ccodec_pngmodule.cpp
index 31de538..dec3f7b 100644
--- a/core/fxcodec/codec/ccodec_pngmodule.cpp
+++ b/core/fxcodec/codec/ccodec_pngmodule.cpp
@@ -8,6 +8,7 @@
 
 #include <algorithm>
 
+#include "core/fxcodec/codec/cfx_codec_memory.h"
 #include "core/fxcodec/codec/codec_int.h"
 #include "core/fxcodec/fx_codec.h"
 #include "core/fxcrt/unowned_ptr.h"
diff --git a/core/fxcodec/codec/ccodec_pngmodule.h b/core/fxcodec/codec/ccodec_pngmodule.h
index 9754cb3..d736528 100644
--- a/core/fxcodec/codec/ccodec_pngmodule.h
+++ b/core/fxcodec/codec/ccodec_pngmodule.h
@@ -10,9 +10,6 @@
 #include <memory>
 
 #include "core/fxcodec/codec/codec_module_iface.h"
-#include "core/fxcrt/fx_system.h"
-
-class CFX_DIBAttribute;
 
 class CCodec_PngModule final : public CodecModuleIface {
  public:
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.cpp b/core/fxcodec/codec/ccodec_progressivedecoder.cpp
index 9d375cb..c3ab8c6 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.cpp
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.cpp
@@ -11,6 +11,7 @@
 #include <utility>
 #include <vector>
 
+#include "core/fxcodec/codec/cfx_codec_memory.h"
 #include "core/fxcodec/fx_codec.h"
 #include "core/fxcrt/fx_stream.h"
 #include "core/fxge/dib/cfx_dibitmap.h"
diff --git a/core/fxcodec/codec/ccodec_tiffmodule.cpp b/core/fxcodec/codec/ccodec_tiffmodule.cpp
index 15b8067..2c2ad14 100644
--- a/core/fxcodec/codec/ccodec_tiffmodule.cpp
+++ b/core/fxcodec/codec/ccodec_tiffmodule.cpp
@@ -9,6 +9,7 @@
 #include <limits>
 #include <memory>
 
+#include "core/fxcodec/codec/cfx_codec_memory.h"
 #include "core/fxcodec/codec/codec_int.h"
 #include "core/fxcodec/fx_codec.h"
 #include "core/fxcrt/fx_safe_types.h"
diff --git a/core/fxcodec/codec/ccodec_tiffmodule.h b/core/fxcodec/codec/ccodec_tiffmodule.h
index eee24de..1306e18 100644
--- a/core/fxcodec/codec/ccodec_tiffmodule.h
+++ b/core/fxcodec/codec/ccodec_tiffmodule.h
@@ -10,11 +10,9 @@
 #include <memory>
 
 #include "core/fxcodec/codec/codec_module_iface.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxcrt/retain_ptr.h"
-#include "core/fxge/dib/cfx_dibitmap.h"
 
 class CFX_DIBAttribute;
+class CFX_DIBitmap;
 class IFX_SeekableReadStream;
 
 class CCodec_TiffModule final : public CodecModuleIface {
diff --git a/core/fxcodec/codec/codec_module_iface.h b/core/fxcodec/codec/codec_module_iface.h
index 52cb564..12a119e 100644
--- a/core/fxcodec/codec/codec_module_iface.h
+++ b/core/fxcodec/codec/codec_module_iface.h
@@ -7,10 +7,10 @@
 #ifndef CORE_FXCODEC_CODEC_CODEC_MODULE_IFACE_H_
 #define CORE_FXCODEC_CODEC_CODEC_MODULE_IFACE_H_
 
-#include "core/fxcodec/codec/cfx_codec_memory.h"
 #include "core/fxcrt/fx_system.h"
-#include "third_party/base/span.h"
+#include "core/fxcrt/retain_ptr.h"
 
+class CFX_CodecMemory;
 class CFX_DIBAttribute;
 
 class CodecModuleIface {
diff --git a/core/fxcodec/gif/cfx_gifcontext.cpp b/core/fxcodec/gif/cfx_gifcontext.cpp
index 076331f..7a95863a 100644
--- a/core/fxcodec/gif/cfx_gifcontext.cpp
+++ b/core/fxcodec/gif/cfx_gifcontext.cpp
@@ -10,6 +10,7 @@
 #include <utility>
 
 #include "core/fxcodec/codec/ccodec_gifmodule.h"
+#include "core/fxcodec/codec/cfx_codec_memory.h"
 #include "core/fxcodec/gif/cfx_gif.h"
 #include "third_party/base/ptr_util.h"
 #include "third_party/base/stl_util.h"
diff --git a/core/fxcodec/gif/cfx_gifcontext.h b/core/fxcodec/gif/cfx_gifcontext.h
index 4cf84a5..5febb59 100644
--- a/core/fxcodec/gif/cfx_gifcontext.h
+++ b/core/fxcodec/gif/cfx_gifcontext.h
@@ -11,13 +11,14 @@
 #include <vector>
 
 #include "core/fxcodec/codec/ccodec_gifmodule.h"
-#include "core/fxcodec/codec/cfx_codec_memory.h"
 #include "core/fxcodec/gif/cfx_gif.h"
 #include "core/fxcodec/gif/cfx_lzwdecompressor.h"
 #include "core/fxcrt/fx_string.h"
 #include "core/fxcrt/unowned_ptr.h"
 #include "third_party/base/span.h"
 
+class CFX_CodecMemory;
+
 class CFX_GifContext : public CodecModuleIface::Context {
  public:
   CFX_GifContext(CCodec_GifModule* gif_module,
diff --git a/core/fxcodec/gif/cfx_gifcontext_unittest.cpp b/core/fxcodec/gif/cfx_gifcontext_unittest.cpp
index 9b081a4..aa18467 100644
--- a/core/fxcodec/gif/cfx_gifcontext_unittest.cpp
+++ b/core/fxcodec/gif/cfx_gifcontext_unittest.cpp
@@ -6,6 +6,7 @@
 
 #include <utility>
 
+#include "core/fxcodec/codec/cfx_codec_memory.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 class CFX_GifContextForTest final : public CFX_GifContext {