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

Unified Diff: components/update_client/task_update.cc

Issue 1440393002: Reland of Change the update_client task runner behavior to continue on shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « components/update_client/task_update.h ('k') | components/update_client/update_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/update_client/task_update.cc
diff --git a/components/update_client/task_update.cc b/components/update_client/task_update.cc
index d253466e7e1110d6ca3b266dca50f308dd0118d0..c6a72e6ee2f15444ede4eff5a2eaa30ff8694b0f 100644
--- a/components/update_client/task_update.cc
+++ b/components/update_client/task_update.cc
@@ -8,6 +8,7 @@
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
+#include "components/update_client/update_client.h"
#include "components/update_client/update_engine.h"
namespace update_client {
@@ -32,23 +33,30 @@
DCHECK(thread_checker_.CalledOnValidThread());
if (ids_.empty()) {
- RunComplete(-1);
+ TaskComplete(Error::ERROR_UPDATE_INVALID_ARGUMENT);
return;
}
update_engine_->Update(
is_foreground_, ids_, crx_data_callback_,
- base::Bind(&TaskUpdate::RunComplete, base::Unretained(this)));
+ base::Bind(&TaskUpdate::TaskComplete, base::Unretained(this)));
+}
+
+void TaskUpdate::Cancel() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ TaskComplete(Error::ERROR_UPDATE_CANCELED);
}
std::vector<std::string> TaskUpdate::GetIds() const {
return ids_;
}
-void TaskUpdate::RunComplete(int error) {
+void TaskUpdate::TaskComplete(int error) {
DCHECK(thread_checker_.CalledOnValidThread());
- callback_.Run(this, error);
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(callback_, this, error));
}
} // namespace update_client
« no previous file with comments | « components/update_client/task_update.h ('k') | components/update_client/update_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698