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

Unified Diff: chrome/browser/extensions/api/declarative/declarative_api.cc

Issue 9416060: Move PostTaskAndReplyWithStatus into task_runner_helpers.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT Created 8 years, 9 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: chrome/browser/extensions/api/declarative/declarative_api.cc
diff --git a/chrome/browser/extensions/api/declarative/declarative_api.cc b/chrome/browser/extensions/api/declarative/declarative_api.cc
index 8f094117fd946f7e73dfcbaccc5b0d5bf5c37705..d85caa287d9459f3f70f5f0ed53f9df374fa6d6c 100644
--- a/chrome/browser/extensions/api/declarative/declarative_api.cc
+++ b/chrome/browser/extensions/api/declarative/declarative_api.cc
@@ -53,23 +53,21 @@ bool RulesFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(rules_registry_);
if (content::BrowserThread::CurrentlyOn(rules_registry_->GetOwnerThread())) {
- RunImplOnCorrectThread();
- SendResponseOnUIThread();
+ bool success = RunImplOnCorrectThread();
+ SendResponse(success);
} else {
- content::BrowserThread::PostTaskAndReply(
- rules_registry_->GetOwnerThread(), FROM_HERE,
- base::Bind(base::IgnoreResult(&RulesFunction::RunImplOnCorrectThread),
- this),
- base::Bind(&RulesFunction::SendResponseOnUIThread, this));
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy =
+ content::BrowserThread::GetMessageLoopProxyForThread(
+ rules_registry_->GetOwnerThread());
+ message_loop_proxy->PostTaskAndReplyWithResult(
+ FROM_HERE,
+ base::Bind(&RulesFunction::RunImplOnCorrectThread, this),
+ base::Bind(&RulesFunction::SendResponse, this));
}
return true;
}
-void RulesFunction::SendResponseOnUIThread() {
- SendResponse(error_.empty());
-}
-
bool AddRulesFunction::RunImplOnCorrectThread() {
scoped_ptr<AddRules::Params> params(AddRules::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
« base/task_runner.h ('K') | « chrome/browser/extensions/api/declarative/declarative_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698