Chromium Code Reviews| 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; |