update_engine: add staging pref to payload_state
Add kPrefsWallClockStagingWaitPeriod as a new pref so that the staging
wait period persists accross reboots. Change the old
kPrefsWallClockWaitPeriod constant to
kPrefsWallClockScatteringWaitPeriod to differentiate more clearly
between the two.
BUG=chromium:858621
TEST=cros_workon_make update_engine --test
Change-Id: Ifc6aeb44271321cdd2f0d4cfa583a7bbc32b9004
Reviewed-on: https://chromium-review.googlesource.com/1138741
Commit-Ready: Adolfo Higueros <adokar@google.com>
Tested-by: Adolfo Higueros <adokar@google.com>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: May Lippert <maybelle@chromium.org>
diff --git a/payload_state.h b/payload_state.h
index e8b0db0..cb6454f 100644
--- a/payload_state.h
+++ b/payload_state.h
@@ -147,6 +147,8 @@
void SetScatteringWaitPeriod(base::TimeDelta wait_period) override;
+ void SetStagingWaitPeriod(base::TimeDelta wait_period) override;
+
void SetP2PUrl(const std::string& url) override {
p2p_url_ = url;
}
@@ -408,8 +410,6 @@
// increments num_reboots.
void UpdateNumReboots();
-
-
// Loads the |kPrefsP2PFirstAttemptTimestamp| state variable from disk
// into |p2p_first_attempt_timestamp_|.
void LoadP2PFirstAttemptTimestamp();
@@ -426,6 +426,9 @@
// Loads the persisted scattering wallclock-based wait period.
void LoadScatteringWaitPeriod();
+ // Loads the persisted staging wallclock-based wait period.
+ void LoadStagingWaitPeriod();
+
// Get the total size of all payloads.
int64_t GetPayloadSize();
@@ -586,6 +589,9 @@
// The current scattering wallclock-based wait period.
base::TimeDelta scattering_wait_period_;
+ // The current staging wallclock-based wait period.
+ base::TimeDelta staging_wait_period_;
+
DISALLOW_COPY_AND_ASSIGN(PayloadState);
};