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

Unified Diff: update_attempter.cc

Issue 6836025: Add support to update_engine to poke Omaha after an update has been applied (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: Fixed bug where last ping day was not properly updated Created 9 years, 8 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: update_attempter.cc
diff --git a/update_attempter.cc b/update_attempter.cc
index f56c0d1275ffd3dca0aeb1e720b5ac59e342a3e4..9a7e88b8b25dcb795b7ea4171657ac2181de78b2 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -128,8 +128,11 @@ void UpdateAttempter::Update(const std::string& app_version,
bool obey_proxies) {
chrome_proxy_resolver_.Init();
if (status_ == UPDATE_STATUS_UPDATED_NEED_REBOOT) {
+ // Although we have applied an update, we still want to ping Omaha
+ // to ensure the number of active statistics is accurate.
LOG(INFO) << "Not updating b/c we already updated and we're waiting for "
- << "reboot";
+ << "reboot, we'll ping Omaha instead";
+ PingOmaha();
return;
}
if (status_ != UPDATE_STATUS_IDLE) {
@@ -173,7 +176,8 @@ void UpdateAttempter::Update(const std::string& app_version,
new OmahaRequestAction(prefs_,
omaha_request_params_,
NULL,
- update_check_fetcher)); // passes ownership
+ update_check_fetcher, // passes ownership
+ false));
shared_ptr<OmahaResponseHandlerAction> response_handler_action(
new OmahaResponseHandlerAction(prefs_));
shared_ptr<FilesystemCopierAction> filesystem_copier_action(
@@ -185,7 +189,8 @@ void UpdateAttempter::Update(const std::string& app_version,
omaha_request_params_,
new OmahaEvent(
OmahaEvent::kTypeUpdateDownloadStarted),
- new LibcurlHttpFetcher(GetProxyResolver())));
+ new LibcurlHttpFetcher(GetProxyResolver()),
+ false));
shared_ptr<DownloadAction> download_action(
new DownloadAction(prefs_, new MultiRangeHTTPFetcher(
new LibcurlHttpFetcher(GetProxyResolver()))));
@@ -199,7 +204,8 @@ void UpdateAttempter::Update(const std::string& app_version,
OmahaEvent::kTypeUpdateDownloadFinished,
OmahaEvent::kResultError,
kActionCodeDownloadPayloadPubKeyVerificationError),
- new LibcurlHttpFetcher(GetProxyResolver())));
+ new LibcurlHttpFetcher(GetProxyResolver()),
+ false));
download_action->set_skip_reporting_signature_fail(
NewPermanentCallback(download_signature_warning.get(),
&OmahaRequestAction::set_should_skip,
@@ -209,7 +215,8 @@ void UpdateAttempter::Update(const std::string& app_version,
omaha_request_params_,
new OmahaEvent(
OmahaEvent::kTypeUpdateDownloadFinished),
- new LibcurlHttpFetcher(GetProxyResolver())));
+ new LibcurlHttpFetcher(GetProxyResolver()),
+ false));
shared_ptr<FilesystemCopierAction> filesystem_verifier_action(
new FilesystemCopierAction(false, true));
shared_ptr<FilesystemCopierAction> kernel_filesystem_verifier_action(
@@ -220,7 +227,8 @@ void UpdateAttempter::Update(const std::string& app_version,
new OmahaRequestAction(prefs_,
omaha_request_params_,
new OmahaEvent(OmahaEvent::kTypeUpdateComplete),
- new LibcurlHttpFetcher(GetProxyResolver())));
+ new LibcurlHttpFetcher(GetProxyResolver()),
+ false));
download_action->set_delegate(this);
response_handler_action_ = response_handler_action;
@@ -501,7 +509,8 @@ bool UpdateAttempter::ScheduleErrorEventAction() {
new OmahaRequestAction(prefs_,
omaha_request_params_,
error_event_.release(), // Pass ownership.
- new LibcurlHttpFetcher(GetProxyResolver())));
+ new LibcurlHttpFetcher(GetProxyResolver()),
+ false));
actions_.push_back(shared_ptr<AbstractAction>(error_event_action));
processor_->EnqueueAction(error_event_action.get());
SetStatusAndNotify(UPDATE_STATUS_REPORTING_ERROR_EVENT);
@@ -602,4 +611,19 @@ void UpdateAttempter::SetupDownload() {
}
}
+void UpdateAttempter::PingOmaha() {
+ shared_ptr<OmahaRequestAction> ping_action(
+ new OmahaRequestAction(prefs_,
+ omaha_request_params_,
+ NULL,
+ new LibcurlHttpFetcher(GetProxyResolver()),
+ true));
+ actions_.push_back(shared_ptr<OmahaRequestAction>(ping_action));
+ CHECK(!processor_->IsRunning());
+ processor_->set_delegate(NULL);
+ processor_->EnqueueAction(ping_action.get());
+ g_idle_add(&StaticStartProcessing, this);
+ SetStatusAndNotify(UPDATE_STATUS_UPDATED_NEED_REBOOT);
+}
+
} // namespace chromeos_update_engine
« no previous file with comments | « update_attempter.h ('k') | update_attempter_unittest.cc » ('j') | update_attempter_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698