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

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

Issue 440012: Fixing 27834 by always deleting ExtensionMessageService on... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « chrome/browser/extensions/extension_message_service.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/extension_message_service.cc
===================================================================
--- chrome/browser/extensions/extension_message_service.cc (revision 32822)
+++ chrome/browser/extensions/extension_message_service.cc (working copy)
@@ -115,6 +115,11 @@
: profile_(profile),
extension_devtools_manager_(NULL),
next_port_id_(0) {
+ if (!ChromeThread::GetCurrentThreadIdentifier(&thread_id_)) {
+ // If we get created in unit test, GetCurrentThreadIdentifier fails.
+ // Assign thread_id_ to an ID not used.
+ thread_id_ = ChromeThread::ID_COUNT;
+ }
registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED,
NotificationService::AllSources());
registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSED,
@@ -132,10 +137,11 @@
void ExtensionMessageService::ProfileDestroyed() {
profile_ = NULL;
-
- // We remove notifications here because our destructor might be called on
- // a non-UI thread.
- registrar_.RemoveAll();
+ if (!registrar_.IsEmpty()) {
+ if (thread_id_ != ChromeThread::ID_COUNT)
+ CHECK(ChromeThread::CurrentlyOn(thread_id_));
Erik does not do reviews 2009/11/25 15:52:11 If GetCurrentThreadIdentifier fails, I don't see h
huanr 2009/11/25 17:16:38 If GetCurrentThreadIdentifier fails, the thread_id
Erik does not do reviews 2009/11/25 17:32:49 I think you're missing my point. CurrentlyOn uses
+ registrar_.RemoveAll();
+ }
}
void ExtensionMessageService::AddEventListener(const std::string& event_name,
« no previous file with comments | « chrome/browser/extensions/extension_message_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698