diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-04-04 14:37:18 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-04 21:48:48 +0000 |
commit | afd0d1f488ea55da545b3310fd8f22e45522a695 (patch) | |
tree | 89136eba4669421b6f828edb9f3d69ee558110d0 /xfa | |
parent | 4f8b044b95dc282959dfe41453e2a9c1ec7e9354 (diff) | |
download | pdfium-afd0d1f488ea55da545b3310fd8f22e45522a695.tar.xz |
RefCount CPDF_StreamAcc all the time.
Pass stream argument to constructor; it feels like a
stream accessor should always be made from a stream rather
than passing one in after the fact.
Change-Id: Iaa46cb37677b81f0170f5d39bab76ad38ea4af44
Reviewed-on: https://pdfium-review.googlesource.com/3620
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fxfa/cxfa_ffapp.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffdoc.cpp | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/xfa/fxfa/cxfa_ffapp.cpp b/xfa/fxfa/cxfa_ffapp.cpp index 78de94e938..7b88626c91 100644 --- a/xfa/fxfa/cxfa_ffapp.cpp +++ b/xfa/fxfa/cxfa_ffapp.cpp @@ -35,13 +35,13 @@ class CXFA_FileRead : public IFX_SeekableReadStream { bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; private: - std::vector<std::unique_ptr<CPDF_StreamAcc>> m_Data; + std::vector<CFX_RetainPtr<CPDF_StreamAcc>> m_Data; }; CXFA_FileRead::CXFA_FileRead(const std::vector<CPDF_Stream*>& streams) { for (CPDF_Stream* pStream : streams) { - m_Data.push_back(pdfium::MakeUnique<CPDF_StreamAcc>()); - m_Data.back()->LoadAllData(pStream); + m_Data.push_back(pdfium::MakeRetain<CPDF_StreamAcc>(pStream)); + m_Data.back()->LoadAllData(); } } diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index f48ae57fb2..993f5bc664 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -388,12 +388,12 @@ CFX_RetainPtr<CFX_DIBitmap> CXFA_FFDoc::GetPDFNamedImage( if (!pStream) return nullptr; - CPDF_StreamAcc streamAcc; - streamAcc.LoadAllData(pStream); + auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream); + pAcc->LoadAllData(); CFX_RetainPtr<IFX_SeekableReadStream> pImageFileRead = - IFX_MemoryStream::Create((uint8_t*)streamAcc.GetData(), - streamAcc.GetSize()); + IFX_MemoryStream::Create(const_cast<uint8_t*>(pAcc->GetData()), + pAcc->GetSize()); CFX_RetainPtr<CFX_DIBitmap> pDibSource = XFA_LoadImageFromBuffer( pImageFileRead, FXCODEC_IMAGE_UNKNOWN, iImageXDpi, iImageYDpi); |