AU: Push seeks in http fetching to the progress percentage.
The updater was reporting status as a fraction of bytes downloaded vs
total, ignoring any bytes that were skipped due to resuming an
upload. The result was that a user may see progress go from 0 to 60
percent, then reboot, then see progress go from 0 to 40 percent, then
finish.
This CL allows an HTTP fetcher to report to the delegate that it's
seeking to a particular offset.
BUG=8151
TEST=applied updates on the machine; unittest
Review URL: http://codereview.chromium.org/4131005
Change-Id: Ib9fe034ca3ffd17455af4cf89d5b28ec236104a0
diff --git a/multi_http_fetcher.h b/multi_http_fetcher.h
index 4328199..692054d 100644
--- a/multi_http_fetcher.h
+++ b/multi_http_fetcher.h
@@ -122,6 +122,8 @@
<< ranges_[current_index_].second << ")";
bytes_received_this_fetcher_ = 0;
fetchers_[current_index_]->SetOffset(ranges_[current_index_].first);
+ if (delegate_)
+ delegate_->SeekToOffset(ranges_[current_index_].first);
fetchers_[current_index_]->BeginTransfer(url_);
}
@@ -141,8 +143,9 @@
bytes_received_this_fetcher_);
}
LOG_IF(WARNING, next_size <= 0) << "Asked to write length <= 0";
- if (delegate_)
+ if (delegate_) {
delegate_->ReceivedBytes(this, bytes, next_size);
+ }
bytes_received_this_fetcher_ += length;
if (ranges_[current_index_].second >= 0 &&
bytes_received_this_fetcher_ >= ranges_[current_index_].second) {