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

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 2030953003: Fixup FPDFAvail_IsPageAvail checks in PDFiumEngine. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « 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 5ee7e623ac43e20b3098cb3097ff2bec45443f99..84943f71dd0a5537b212ed67ce643afd8c9d5d04 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -1099,7 +1099,13 @@ void PDFiumEngine::FinishLoadingDocument() {
pages_[i]->set_available(true);
// We still need to call IsPageAvail() even if the whole document is
// already downloaded.
- FPDFAvail_IsPageAvail(fpdf_availability_, i, &download_hints_);
+ while (true) {
dsinclair 2016/06/02 18:03:25 This is probably bad, and I feel bad, but I wasn't
+ int val = FPDFAvail_IsPageAvail(fpdf_availability_, i, &download_hints_);
+ if (val == PDF_DATA_ERROR)
+ return;
+ if (val == PDF_DATA_AVAIL)
+ break;
+ }
need_update = true;
if (IsPageVisible(i))
client_->Invalidate(GetPageScreenRect(i));
@@ -2634,7 +2640,8 @@ bool PDFiumEngine::CheckPageAvailable(int index, std::vector<int>* pending) {
if (index < num_pages && pages_[index]->available())
return true;
- if (!FPDFAvail_IsPageAvail(fpdf_availability_, index, &download_hints_)) {
+ if (FPDFAvail_IsPageAvail(fpdf_availability_, index, &download_hints_) !=
+ PDF_DATA_AVAIL) {
if (!ContainsValue(*pending, index))
pending->push_back(index);
return 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