Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 1552603002: Support loading complete linearized PDF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdfium/pdfium_engine.cc
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index 0528c94ecca007a1e58ec053c96689974027318d..9bf10fb7c515dbe0390117372f5955b2f79ff83e 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -1156,6 +1156,12 @@ void PDFiumEngine::OnDocumentComplete() {
return;
}
+ FinishLoadingDocument();
+}
+
+void PDFiumEngine::FinishLoadingDocument() {
+ DCHECK(doc_loader_.IsDocumentComplete() && doc_);
+
bool need_update = false;
for (size_t i = 0; i < pages_.size(); ++i) {
if (pages_[i]->available())
@@ -1172,11 +1178,6 @@ void PDFiumEngine::OnDocumentComplete() {
if (need_update)
LoadPageInfo(true);
- FinishLoadingDocument();
-}
-
-void PDFiumEngine::FinishLoadingDocument() {
- DCHECK(doc_loader_.IsDocumentComplete() && doc_);
if (called_do_document_action_)
return;
called_do_document_action_ = true;
@@ -2667,7 +2668,10 @@ void PDFiumEngine::LoadPageInfo(bool reload) {
if (reload) {
pages_[i]->set_rect(page_rect);
} else {
- pages_.push_back(new PDFiumPage(this, i, page_rect, doc_complete));
+ // The page is marked as not being available even if |doc_complete| is
+ // true because FPDFAvail_IsPageAvail() still has to be called for this
+ // page, which will be done in FinishLoadingDocument().
+ pages_.push_back(new PDFiumPage(this, i, page_rect, false));
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698