p2p: Add HttpPeer to DownloadSource enumeration
This way the Installer.DownloadSourcesUsed metric conveys how often
p2p is used and new metrics Installer.SuccessfulMBsDownloadedFromHttpPeer
and Installer.TotalMBsDownloadedFromHttpPeer gives additional detail.
BUG=chromium:284714
TEST=modify unit tests to cover this case + unit tests pass
Change-Id: Ia4dff090091a282e1a184c2b18f8290749f5fdeb
Reviewed-on: https://chromium-review.googlesource.com/167913
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
diff --git a/payload_state.h b/payload_state.h
index f0b74e5..f358bda 100644
--- a/payload_state.h
+++ b/payload_state.h
@@ -44,6 +44,7 @@
virtual bool ShouldBackoffDownload();
virtual void Rollback();
virtual void ExpectRebootInNewVersion(const std::string& target_version_uid);
+ virtual void SetUsingP2PForDownloading(bool value);
virtual inline std::string GetResponseSignature() {
return response_signature_;
@@ -104,6 +105,10 @@
virtual void P2PNewAttempt();
virtual bool P2PAttemptAllowed();
+ virtual bool GetUsingP2PForDownloading() {
+ return using_p2p_for_downloading_;
+ }
+
private:
friend class PayloadStateTest;
FRIEND_TEST(PayloadStateTest, RebootAfterUpdateFailedMetric);
@@ -385,6 +390,10 @@
// This is the current response object from Omaha.
OmahaResponse response_;
+ // Whether p2p is being used for downloading as set with the
+ // SetUsingP2PForDownloading() method.
+ bool using_p2p_for_downloading_;
+
// This stores a "signature" of the current response. The signature here
// refers to a subset of the current response from Omaha. Each update to
// this value is persisted so we resume from the same value in case of a