Skip to content

Commit

Permalink
PDF: Fix progress bar for files of unknown size.
Browse files Browse the repository at this point in the history
BUG=666663

Review-Url: https://codereview.chromium.org/2516453003
Cr-Commit-Position: refs/heads/master@{#433330}
  • Loading branch information
leizleiz authored and Commit bot committed Nov 18, 2016
1 parent 7cd55da commit 2c81990
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pdf/pdfium/pdfium_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 2c81990

Please sign in to comment.