diff options
author | Artem Strygin <art-snake@yandex-team.ru> | 2018-07-12 09:18:19 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-12 09:18:19 +0000 |
commit | 68d04f284423414392b7176cbd74671f50bae196 (patch) | |
tree | 301549bb7b2ed8e96d5bfd8a44ff0e51c47f9676 /core/fpdfapi/edit | |
parent | d8882193737ae167a33c1bf7a5cdb64543ad0301 (diff) | |
download | pdfium-68d04f284423414392b7176cbd74671f50bae196.tar.xz |
Reland "Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream()."
This is a reland of 77f15f7883638a4ced131d74c053af10a5970ce9
Original change's description:
> Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream().
>
> Allow sub-streams created from an IFX_SeekableReadStream to provide
> stream data without copying memory.
> The data will only reside in the top-level stream.
>
> For example:
> For file
> http://www.major-landrover.ru/upload/attachments/f/9/f96aab07dab04ae89c8a509ec1ef2b31.pdf
> (18 Mb)
>
> The memory usage is reduced by ~13 Mb.
>
> Change-Id: I2595c014d0fbe1fdd181cc04965cfd7d901c2d88
> Reviewed-on: https://pdfium-review.googlesource.com/35930
> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
> Reviewed-by: dsinclair <dsinclair@chromium.org>
Change-Id: I4c4d5dcf42ff44784468ac7a7c302df509fc804d
Reviewed-on: https://pdfium-review.googlesource.com/37313
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Diffstat (limited to 'core/fpdfapi/edit')
-rw-r--r-- | core/fpdfapi/edit/cpdf_flateencoder.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/edit/cpdf_flateencoder.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/core/fpdfapi/edit/cpdf_flateencoder.cpp b/core/fpdfapi/edit/cpdf_flateencoder.cpp index a290da6dac..573c141ff2 100644 --- a/core/fpdfapi/edit/cpdf_flateencoder.cpp +++ b/core/fpdfapi/edit/cpdf_flateencoder.cpp @@ -15,7 +15,7 @@ CPDF_FlateEncoder::CPDF_FlateEncoder(const CPDF_Stream* pStream, bool bFlateEncode) - : m_dwSize(0), m_pAcc(pdfium::MakeRetain<CPDF_StreamAcc>(pStream)) { + : m_pAcc(pdfium::MakeRetain<CPDF_StreamAcc>(pStream)), m_dwSize(0) { m_pAcc->LoadAllDataRaw(); bool bHasFilter = pStream && pStream->HasFilter(); diff --git a/core/fpdfapi/edit/cpdf_flateencoder.h b/core/fpdfapi/edit/cpdf_flateencoder.h index 05633f6814..14ca7cec16 100644 --- a/core/fpdfapi/edit/cpdf_flateencoder.h +++ b/core/fpdfapi/edit/cpdf_flateencoder.h @@ -34,14 +34,14 @@ class CPDF_FlateEncoder { } private: + RetainPtr<CPDF_StreamAcc> m_pAcc; + uint32_t m_dwSize; MaybeOwned<uint8_t, FxFreeDeleter> m_pData; // Only one of these two pointers is valid at any time. UnownedPtr<const CPDF_Dictionary> m_pDict; std::unique_ptr<CPDF_Dictionary> m_pClonedDict; - - RetainPtr<CPDF_StreamAcc> m_pAcc; }; #endif // CORE_FPDFAPI_EDIT_CPDF_FLATEENCODER_H_ |