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

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 2006793003: PDF: Always call FPDFAvail_IsDocAvail() when loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 7 months 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 | « pdf/pdfium/pdfium_engine.h ('k') | 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 ac00af5c590d3827fb2493b4e615f44729fed331..bf0d042fe05671bdb735b6d992ff296db0b918eb 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -298,7 +298,7 @@ FPDF_SYSFONTINFO g_font_info = {
};
#endif // defined(OS_LINUX)
-PDFiumEngine* g_engine_for_unsupported;
+PDFiumEngine* g_engine_for_unsupported = nullptr;
void Unsupported_Handler(UNSUPPORT_INFO*, int type) {
if (!g_engine_for_unsupported) {
@@ -2391,10 +2391,13 @@ void PDFiumEngine::AppendBlankPages(int num_pages) {
void PDFiumEngine::LoadDocument() {
// Check if the document is ready for loading. If it isn't just bail for now,
// we will call LoadDocument() again later.
- if (!doc_ && !doc_loader_.IsDocumentComplete() &&
- !FPDFAvail_IsDocAvail(fpdf_availability_, &download_hints_)) {
Wei Li 2016/05/24 00:21:27 Should these conditions be ORed instead?
Lei Zhang 2016/05/25 17:16:36 No, we have to continue past this point to turn |d
+ if (!doc_ && !doc_loader_.IsDocumentComplete())
+ return;
+
+ // Always call FPDFAvail_IsDocAvail() so PDFium initializes internal data
+ // structures.
+ if (!FPDFAvail_IsDocAvail(fpdf_availability_, &download_hints_))
return;
- }
// If we're in the middle of getting a password, just return. We will retry
// loading the document after we get the password anyway.
« no previous file with comments | « pdf/pdfium/pdfium_engine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698