From 5527682463d1c250e01e868655b58da7625db0c1 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 19 Jul 2018 17:39:15 +0000 Subject: Make FX stream internal details more private to .cpp files. Makes the generic fx_streams.h header pull in lots less OS-specific cluter. Combine and de-virtualize the windows struct. Change-Id: I836b9efb00b25dbd1b8f814645dd31a0f04bb4f4 Reviewed-on: https://pdfium-review.googlesource.com/38330 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- BUILD.gn | 9 ++++++--- core/fxcrt/cfx_fileaccess_posix.cpp | 4 ++++ core/fxcrt/fx_stream.cpp | 10 ++++++++++ core/fxcrt/fx_stream.h | 23 ++--------------------- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 16eaffd785..135d392e0c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -854,8 +854,6 @@ jumbo_static_library("fxcrt") { "core/fxcrt/cfx_bitstream.h", "core/fxcrt/cfx_datetime.cpp", "core/fxcrt/cfx_datetime.h", - "core/fxcrt/cfx_fileaccess_posix.cpp", - "core/fxcrt/cfx_fileaccess_posix.h", "core/fxcrt/cfx_fileaccess_windows.cpp", "core/fxcrt/cfx_fileaccess_windows.h", "core/fxcrt/cfx_fixedbufgrow.h", @@ -930,7 +928,12 @@ jumbo_static_library("fxcrt") { "third_party:pdfium_base", "//third_party/icu:icuuc", ] - + if (is_posix || is_fuchsia) { + sources += [ + "core/fxcrt/cfx_fileaccess_posix.cpp", + "core/fxcrt/cfx_fileaccess_posix.h", + ] + } if (pdf_enable_xfa) { sources += [ "core/fxcrt/cfx_char.cpp", diff --git a/core/fxcrt/cfx_fileaccess_posix.cpp b/core/fxcrt/cfx_fileaccess_posix.cpp index 4aab6fef46..fdcf4ae6bb 100644 --- a/core/fxcrt/cfx_fileaccess_posix.cpp +++ b/core/fxcrt/cfx_fileaccess_posix.cpp @@ -6,6 +6,10 @@ #include "core/fxcrt/cfx_fileaccess_posix.h" +#include +#include +#include + #include #include "third_party/base/ptr_util.h" diff --git a/core/fxcrt/fx_stream.cpp b/core/fxcrt/fx_stream.cpp index 337cbb325c..4d61b0a6ec 100644 --- a/core/fxcrt/fx_stream.cpp +++ b/core/fxcrt/fx_stream.cpp @@ -15,6 +15,16 @@ #include "core/fxcrt/fx_safe_types.h" #include "third_party/base/ptr_util.h" +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ +#include + +struct CFindFileDataA { + HANDLE m_Handle; + bool m_bEnd; + WIN32_FIND_DATAA m_FindData; +}; +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ + namespace { class CFX_CRTFileStream final : public IFX_SeekableStream { diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h index 8d0a596bd9..b41d413723 100644 --- a/core/fxcrt/fx_stream.h +++ b/core/fxcrt/fx_stream.h @@ -12,20 +12,16 @@ #include "core/fxcrt/retain_ptr.h" #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ -#include -class CFindFileDataA; +struct CFindFileDataA; typedef CFindFileDataA FX_FileHandle; #else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ #include -#include -#include #include -#include - typedef DIR FX_FileHandle; + #endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ FX_FileHandle* FX_OpenFolder(const char* path); @@ -108,19 +104,4 @@ class IFX_SeekableStream : public IFX_SeekableReadStream, bool Flush() override = 0; }; -#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ -class CFindFileData { - public: - virtual ~CFindFileData() {} - HANDLE m_Handle; - bool m_bEnd; -}; - -class CFindFileDataA : public CFindFileData { - public: - ~CFindFileDataA() override {} - WIN32_FIND_DATAA m_FindData; -}; -#endif - #endif // CORE_FXCRT_FX_STREAM_H_ -- cgit v1.2.3