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/http_fetcher.h b/http_fetcher.h
index f61116a..d0f9cb2 100644
--- a/http_fetcher.h
+++ b/http_fetcher.h
@@ -89,12 +89,14 @@
// Interface for delegates
class HttpFetcherDelegate {
public:
- // Called every time bytes are received, even if they are automatically
- // delivered to an output file.
+ // Called every time bytes are received.
virtual void ReceivedBytes(HttpFetcher* fetcher,
const char* bytes,
int length) = 0;
+ // Called if the fetcher seeks to a particular offset.
+ virtual void SeekToOffset(off_t offset) {}
+
// Called when the transfer has completed successfully or been somehow
// aborted.
virtual void TransferComplete(HttpFetcher* fetcher, bool successful) = 0;