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

Unified Diff: chrome/browser/extensions/extension_message_service.cc

Issue 345023: Get rid of MessageLoop* caching in extensions code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/extension_message_service.cc
===================================================================
--- chrome/browser/extensions/extension_message_service.cc (revision 30521)
+++ chrome/browser/extensions/extension_message_service.cc (working copy)
@@ -112,12 +112,9 @@
"Event.dispatchJSON";
ExtensionMessageService::ExtensionMessageService(Profile* profile)
- : ui_loop_(MessageLoop::current()),
- profile_(profile),
+ : profile_(profile),
extension_devtools_manager_(NULL),
next_port_id_(0) {
- DCHECK_EQ(ui_loop_->type(), MessageLoop::TYPE_UI);
-
registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED,
NotificationService::AllSources());
registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSED,
@@ -132,8 +129,6 @@
}
void ExtensionMessageService::ProfileDestroyed() {
- DCHECK_EQ(ui_loop_->type(), MessageLoop::TYPE_UI);
-
profile_ = NULL;
// We remove notifications here because our destructor might be called on
@@ -207,9 +202,10 @@
// Each side of the port is given his own port ID. When they send messages,
// we convert to the opposite port ID. See PostMessageFromRenderer.
- ui_loop_->PostTask(FROM_HERE,
- NewRunnableMethod(this,
- &ExtensionMessageService::OpenChannelToExtensionOnUIThread,
+ ChromeThread::PostTask(
+ ChromeThread::UI, FROM_HERE,
+ NewRunnableMethod(
+ this, &ExtensionMessageService::OpenChannelToExtensionOnUIThread,
source->id(), routing_id, port2_id, source_extension_id,
target_extension_id, channel_name));
@@ -230,9 +226,10 @@
// Each side of the port is given his own port ID. When they send messages,
// we convert to the opposite port ID. See PostMessageFromRenderer.
- ui_loop_->PostTask(FROM_HERE,
- NewRunnableMethod(this,
- &ExtensionMessageService::OpenChannelToTabOnUIThread,
+ ChromeThread::PostTask(
+ ChromeThread::UI, FROM_HERE,
+ NewRunnableMethod(
+ this, &ExtensionMessageService::OpenChannelToTabOnUIThread,
source->id(), routing_id, port2_id, tab_id, extension_id,
channel_name));
« no previous file with comments | « chrome/browser/extensions/extension_message_service.h ('k') | chrome/browser/extensions/extension_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698