summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2018-07-12 09:18:19 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-12 09:18:19 +0000
commit68d04f284423414392b7176cbd74671f50bae196 (patch)
tree301549bb7b2ed8e96d5bfd8a44ff0e51c47f9676 /testing
parentd8882193737ae167a33c1bf7a5cdb64543ad0301 (diff)
downloadpdfium-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 'testing')
-rw-r--r--testing/embedder_test.cpp4
-rw-r--r--testing/embedder_test.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index e4ac4ad2c7..e874640218 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -351,7 +351,9 @@ FPDF_DOCUMENT EmbedderTest::OpenSavedDocument(const char* password) {
memset(&saved_file_access_, 0, sizeof(saved_file_access_));
saved_file_access_.m_FileLen = data_string_.size();
saved_file_access_.m_GetBlock = GetBlockFromString;
- saved_file_access_.m_Param = &data_string_;
+ // Copy data to prevent clearing it before saved document close.
+ saved_document_file_data_ = data_string_;
+ saved_file_access_.m_Param = &saved_document_file_data_;
saved_fake_file_access_ =
pdfium::MakeUnique<FakeFileAccess>(&saved_file_access_);
diff --git a/testing/embedder_test.h b/testing/embedder_test.h
index e8f76c058f..b0dada0341 100644
--- a/testing/embedder_test.h
+++ b/testing/embedder_test.h
@@ -260,6 +260,7 @@ class EmbedderTest : public ::testing::Test,
int GetPageNumberForSavedPage(FPDF_PAGE page) const;
std::string data_string_;
+ std::string saved_document_file_data_;
std::ofstream filestream_;
};