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

Side by Side Diff: update_attempter.cc

Issue 3034026: AU: Provide a reboot_if_needed D-Bus API. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: reboot error code doesn't necessarily signal a problem. Created 10 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « update_attempter.h ('k') | update_engine.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "update_engine/update_attempter.h" 5 #include "update_engine/update_attempter.h"
6 6
7 // From 'man clock_gettime': feature test macro: _POSIX_C_SOURCE >= 199309L 7 // From 'man clock_gettime': feature test macro: _POSIX_C_SOURCE >= 199309L
8 #ifndef _POSIX_C_SOURCE 8 #ifndef _POSIX_C_SOURCE
9 #define _POSIX_C_SOURCE 199309L 9 #define _POSIX_C_SOURCE 199309L
10 #endif // _POSIX_C_SOURCE 10 #endif // _POSIX_C_SOURCE
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 void UpdateAttempter::CheckForUpdate(const std::string& app_version, 214 void UpdateAttempter::CheckForUpdate(const std::string& app_version,
215 const std::string& omaha_url) { 215 const std::string& omaha_url) {
216 if (status_ != UPDATE_STATUS_IDLE) { 216 if (status_ != UPDATE_STATUS_IDLE) {
217 LOG(INFO) << "Check for update requested, but status is " 217 LOG(INFO) << "Check for update requested, but status is "
218 << UpdateStatusToString(status_) << ", so not checking."; 218 << UpdateStatusToString(status_) << ", so not checking.";
219 return; 219 return;
220 } 220 }
221 Update(app_version, omaha_url); 221 Update(app_version, omaha_url);
222 } 222 }
223 223
224 bool UpdateAttempter::RebootIfNeeded() {
225 if (status_ != UPDATE_STATUS_UPDATED_NEED_REBOOT) {
226 LOG(INFO) << "Reboot requested, but status is "
227 << UpdateStatusToString(status_) << ", so not rebooting.";
228 return false;
229 }
230 TEST_AND_RETURN_FALSE(utils::Reboot());
231 return true;
232 }
233
224 // Delegate methods: 234 // Delegate methods:
225 void UpdateAttempter::ProcessingDone(const ActionProcessor* processor, 235 void UpdateAttempter::ProcessingDone(const ActionProcessor* processor,
226 ActionExitCode code) { 236 ActionExitCode code) {
227 CHECK(response_handler_action_); 237 CHECK(response_handler_action_);
228 LOG(INFO) << "Processing Done."; 238 LOG(INFO) << "Processing Done.";
229 actions_.clear(); 239 actions_.clear();
230 240
231 if (status_ == UPDATE_STATUS_REPORTING_ERROR_EVENT) { 241 if (status_ == UPDATE_STATUS_REPORTING_ERROR_EVENT) {
232 LOG(INFO) << "Error event sent."; 242 LOG(INFO) << "Error event sent.";
233 SetStatusAndNotify(UPDATE_STATUS_IDLE); 243 SetStatusAndNotify(UPDATE_STATUS_IDLE);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 error_event_.release(), // Pass ownership. 393 error_event_.release(), // Pass ownership.
384 new LibcurlHttpFetcher)); 394 new LibcurlHttpFetcher));
385 actions_.push_back(shared_ptr<AbstractAction>(error_event_action)); 395 actions_.push_back(shared_ptr<AbstractAction>(error_event_action));
386 processor_.EnqueueAction(error_event_action.get()); 396 processor_.EnqueueAction(error_event_action.get());
387 SetStatusAndNotify(UPDATE_STATUS_REPORTING_ERROR_EVENT); 397 SetStatusAndNotify(UPDATE_STATUS_REPORTING_ERROR_EVENT);
388 processor_.StartProcessing(); 398 processor_.StartProcessing();
389 return true; 399 return true;
390 } 400 }
391 401
392 } // namespace chromeos_update_engine 402 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « update_attempter.h ('k') | update_engine.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698