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

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 2516453003: PDF: Fix progress bar for files of unknown size. (Closed)
Patch Set: Created 4 years, 1 month 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 539c487acf86ab41ec7871cd1a7d307d0527cc61..0853d79beb294ae9a103eb0e065615401ec53148 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -1214,12 +1214,15 @@ void PDFiumEngine::OnPendingRequestComplete() {
}
void PDFiumEngine::OnNewDataAvailable() {
- const float progress = doc_loader_->GetProgress();
- if (progress < 0.001) {
- client_->DocumentLoadProgress(0, 0);
- } else {
- client_->DocumentLoadProgress(progress * 10000, 10000);
+ if (!doc_loader_->GetDocumentSize()) {
+ client_->DocumentLoadProgress(doc_loader_->count_of_bytes_received(), 0);
+ return;
}
+
+ const float progress = doc_loader_->GetProgress();
+ DCHECK_GE(progress, 0.0);
+ DCHECK_LE(progress, 1.0);
+ client_->DocumentLoadProgress(progress * 10000, 10000);
}
void PDFiumEngine::OnDocumentComplete() {
« 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