Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Unified Diff: src/platform/update_engine/update_attempter.cc

Issue 2055008: Init: Start Update Engine at startup (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/platform/update_engine/update_attempter.cc
diff --git a/src/platform/update_engine/update_attempter.cc b/src/platform/update_engine/update_attempter.cc
index ebfcd1d587291f73e7ba3b8ee99b0870042553a3..ec0e1f59c73e731d5a56528bcb677e9ce77a805c 100644
--- a/src/platform/update_engine/update_attempter.cc
+++ b/src/platform/update_engine/update_attempter.cc
@@ -30,6 +30,8 @@ using std::vector;
namespace chromeos_update_engine {
+const char* kUpdateCompletedMarker = "/tmp/update_engine_autoupdate_completed";
+
namespace {
// Returns true on success.
bool GetCPUClockTime(struct timespec* out) {
@@ -84,6 +86,15 @@ const char* UpdateStatusToString(UpdateStatus status) {
}
void UpdateAttempter::Update(bool force_full_update) {
+ if (status_ == UPDATE_STATUS_UPDATED_NEED_REBOOT) {
+ LOG(INFO) << "Not updating b/c we already updated and we're waiting for "
+ << "reboot";
+ return;
+ }
+ if (status_ != UPDATE_STATUS_IDLE) {
+ // Update in progress. Do nothing
+ return;
+ }
full_update_ = force_full_update;
CHECK(!processor_.IsRunning());
processor_.set_delegate(this);
@@ -167,8 +178,10 @@ void UpdateAttempter::ProcessingDone(const ActionProcessor* processor,
bool success) {
CHECK(response_handler_action_);
LOG(INFO) << "Processing Done.";
+ actions_.clear();
if (success) {
SetStatusAndNotify(UPDATE_STATUS_UPDATED_NEED_REBOOT);
+ utils::WriteFile(kUpdateCompletedMarker, "", 0);
} else {
LOG(INFO) << "Update failed.";
SetStatusAndNotify(UPDATE_STATUS_IDLE);
@@ -178,6 +191,7 @@ void UpdateAttempter::ProcessingDone(const ActionProcessor* processor,
void UpdateAttempter::ProcessingStopped(const ActionProcessor* processor) {
download_progress_ = 0.0;
SetStatusAndNotify(UPDATE_STATUS_IDLE);
+ actions_.clear();
}
// Called whenever an action has finished processing, either successfully
« src/platform/update_engine/main.cc ('K') | « src/platform/update_engine/update_attempter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698