update_engine: Make SystemState accessible from everywhere
SystemState is supposed to be a global context and is used lamost
everywhere. So instead of passing it to functions and keeping multiple
pointers to it, its better to do what we did in dlcservice and make it a
singleton class with a getter that can be get from everywhere.
BUG=b:171829801
TEST=unittests
Change-Id: I3b2de9394b7769b3911195ca52d61dbe49afd4dd
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2521792
Commit-Queue: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/update_manager/real_updater_provider.h b/update_manager/real_updater_provider.h
index a32e7e9..24298d7 100644
--- a/update_manager/real_updater_provider.h
+++ b/update_manager/real_updater_provider.h
@@ -20,7 +20,6 @@
#include <memory>
#include <string>
-#include "update_engine/common/system_state.h"
#include "update_engine/update_manager/generic_variables.h"
#include "update_engine/update_manager/updater_provider.h"
@@ -34,8 +33,7 @@
// guarantees that parts of the system state can be mocked out at any time
// during testing. We further assume that, by the time Init() is called, the
// system state object is fully populated and usable.
- explicit RealUpdaterProvider(
- chromeos_update_engine::SystemState* system_state);
+ RealUpdaterProvider();
// Initializes the provider and returns whether it succeeded.
bool Init() { return true; }
@@ -99,9 +97,6 @@
}
private:
- // A pointer to the update engine's system state aggregator.
- chromeos_update_engine::SystemState* system_state_;
-
// Variable implementations.
ConstCopyVariable<base::Time> var_updater_started_time_;
std::unique_ptr<Variable<base::Time>> var_last_checked_time_;