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

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: Fixed copyright header Created 8 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
« no previous file with comments | « chrome/browser/extensions/api/declarative/declarative_api.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 72d9fc150dfb8c8d305fe63a6ba1da3f0f875fbb..4c247e0b1a7cb3a03bd3fe3b79d43cf579ff91d9 100644
--- a/chrome/browser/extensions/api/declarative/declarative_api.cc
+++ b/chrome/browser/extensions/api/declarative/declarative_api.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/task_runner_util.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/declarative/rules_registry_service.h"
#include "chrome/browser/extensions/extension_system_factory.h"
@@ -54,23 +55,22 @@ 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());
+ base::PostTaskAndReplyWithResult(
+ message_loop_proxy,
+ 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());
« no previous file with comments | « 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