From ac121aa23a5ee3290af151dddbbdc0f4644098d4 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 19 Feb 2016 15:25:02 -0800 Subject: Remove IFX_BufferArchive. Merge it into CFX_FileBufferArchive, since both are in the same header file and it is the only subclass. Also, bTakeOver is always false, and the buf size is always 32K. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1712353002 . --- core/include/fxcrt/fx_basic.h | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) (limited to 'core/include/fxcrt/fx_basic.h') diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index 3e30b1d1a1..018a91462e 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -179,46 +179,26 @@ class CFX_ArchiveLoader { }; #endif // PDF_ENABLE_XFA -class IFX_BufferArchive { +class CFX_FileBufferArchive { public: - IFX_BufferArchive(FX_STRSIZE size); - virtual ~IFX_BufferArchive() {} - - virtual void Clear(); - - FX_BOOL Flush(); + CFX_FileBufferArchive(); + void Clear(); + bool Flush(); int32_t AppendBlock(const void* pBuf, size_t size); - int32_t AppendByte(uint8_t byte); - int32_t AppendDWord(FX_DWORD i); - int32_t AppendString(const CFX_ByteStringC& lpsz); - protected: - virtual FX_BOOL DoWork(const void* pBuf, size_t size) = 0; - - FX_STRSIZE m_BufSize; - - uint8_t* m_pBuffer; - - FX_STRSIZE m_Length; -}; - -class CFX_FileBufferArchive : public IFX_BufferArchive { - public: - CFX_FileBufferArchive(FX_STRSIZE size = 32768); - ~CFX_FileBufferArchive() override; - - void Clear() override; - FX_BOOL AttachFile(IFX_StreamWrite* pFile, FX_BOOL bTakeover = FALSE); + // |pFile| must outlive the CFX_FileBufferArchive. + void AttachFile(IFX_StreamWrite* pFile); private: - FX_BOOL DoWork(const void* pBuf, size_t size) override; + static const size_t kBufSize = 32768; + size_t m_Length; + std::unique_ptr m_pBuffer; IFX_StreamWrite* m_pFile; - FX_BOOL m_bTakeover; }; class CFX_CharMap { -- cgit v1.2.3