Start action processing asynchronously in UpdateAttempter.
This is done so that we unblock the event loop on dbus calls.
BUG=chromium-os:12758
TEST=unit tests, tested updating the device
Change-Id: I38d9869afb392264a020fc6c653a20622fd38ada
Review URL: http://codereview.chromium.org/6624082
diff --git a/update_attempter.cc b/update_attempter.cc
index e49a551..c9ee712 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -248,7 +248,9 @@
postinstall_runner_action.get());
SetStatusAndNotify(UPDATE_STATUS_CHECKING_FOR_UPDATE);
- processor_->StartProcessing();
+
+ // Start the processing asynchronously to unblock the event loop.
+ g_idle_add(&StaticStartProcessing, this);
}
void UpdateAttempter::CheckForUpdate(const std::string& app_version,
@@ -527,6 +529,11 @@
return reinterpret_cast<UpdateAttempter*>(data)->ManagePriorityCallback();
}
+gboolean UpdateAttempter::StaticStartProcessing(gpointer data) {
+ reinterpret_cast<UpdateAttempter*>(data)->processor_->StartProcessing();
+ return FALSE; // Don't call this callback again.
+}
+
bool UpdateAttempter::ManagePriorityCallback() {
SetPriority(utils::kProcessPriorityNormal);
manage_priority_source_ = NULL;