AU: MultiHttpFetcher cleanup/rewrite
This is the first of many CLs to cleanup/refactor/unfork the
HttpFetcher classes.
This CL changes MultiHttpFetcher to MultiRangeHTTPFetcher, makes it
work with a single base fetcher, and un-templatizes it.
Also, fix a (new?) bug in SConstruct w/ setting CCFLAGS.
TEST=unittests, tested an interrupted/resumed update on device.
BUG=10395
Review URL: http://codereview.chromium.org/5835004
Change-Id: I8422358a6d425233987dd799c5ee7c87135d85fd
diff --git a/http_fetcher.h b/http_fetcher.h
index a50c760..e4f791a 100644
--- a/http_fetcher.h
+++ b/http_fetcher.h
@@ -86,6 +86,12 @@
virtual void set_idle_seconds(int seconds) {}
virtual void set_retry_seconds(int seconds) {}
+ ProxyResolver* proxy_resolver() const { return proxy_resolver_; }
+
+ // These are used for testing:
+ virtual void SetConnectionAsExpensive(bool is_expensive) {}
+ virtual void SetBuildType(bool is_official) {}
+
protected:
// The URL we're actively fetching from
std::string url_;
@@ -122,13 +128,11 @@
// Called if the fetcher seeks to a particular offset.
virtual void SeekToOffset(off_t offset) {}
- // Called when the transfer has completed successfully or been aborted through
- // means other than TerminateTransfer. It's OK to destroy the |fetcher| object
- // in this callback.
+ // When a transfer has completed, exactly one of these two methods will be
+ // called. TransferTerminated is called when the transfer has been aborted
+ // through TerminateTransfer. TransferComplete is called in all other
+ // situations. It's OK to destroy the |fetcher| object in this callback.
virtual void TransferComplete(HttpFetcher* fetcher, bool successful) = 0;
-
- // Called when the transfer has been aborted through TerminateTransfer. It's
- // OK to destroy the |fetcher| object in this callback.
virtual void TransferTerminated(HttpFetcher* fetcher) {}
};