update_engine: Move scattering wait period store/load to PayloadState.
This is needed for decoupling the inference/use of this value from its
storing/loading, as we shift the former into the Update Manager.
BUG=chromium:384087
TEST=Unit tests.
Change-Id: I4b278dc817b6f148d5638122f934e9d1e280bfae
Reviewed-on: https://chromium-review.googlesource.com/221250
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/payload_state.h b/payload_state.h
index 99e7d84..8eb541c 100644
--- a/payload_state.h
+++ b/payload_state.h
@@ -113,6 +113,12 @@
return using_p2p_for_downloading_;
}
+ base::TimeDelta GetScatteringWaitPeriod() override {
+ return scattering_wait_period_;
+ }
+
+ void SetScatteringWaitPeriod(base::TimeDelta wait_period) override;
+
private:
enum class AttemptType {
kUpdate,
@@ -386,6 +392,9 @@
// Sets the |kPrefsP2PFirstAttemptTimestamp| state variable to |time|.
void SetP2PFirstAttemptTimestamp(const base::Time& time);
+ // Loads the persisted scattering wallclock-based wait period.
+ void LoadScatteringWaitPeriod();
+
// The global state of the system.
SystemState* system_state_;
@@ -529,6 +538,9 @@
// Whether we're currently rolling back.
AttemptType attempt_type_;
+ // The current scattering wallclock-based wait period.
+ base::TimeDelta scattering_wait_period_;
+
DISALLOW_COPY_AND_ASSIGN(PayloadState);
};