summaryrefslogtreecommitdiffstats
path: root/base/observer_list_threadsafe.h
diff options
context:
space:
mode:
authormbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-03 17:15:07 +0000
committermbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-03 17:15:07 +0000
commit67bdbe0e44d9af419bdfa7d658d270c8f1005178 (patch)
tree9cfbf67f81d6f6f01cbea978b6cc890fc2c6fa60 /base/observer_list_threadsafe.h
parentc1769d059bf8119de2df418d078310d382f470e6 (diff)
downloadchromium_src-67bdbe0e44d9af419bdfa7d658d270c8f1005178.zip
chromium_src-67bdbe0e44d9af419bdfa7d658d270c8f1005178.tar.gz
chromium_src-67bdbe0e44d9af419bdfa7d658d270c8f1005178.tar.bz2
Make the SystemMonitor observer list thread safe.
This is done by using the new observer_list_threadsafe. Review URL: http://codereview.chromium.org/4288 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4452 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/observer_list_threadsafe.h')
-rw-r--r--base/observer_list_threadsafe.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h
index fcfa0ed..f76f063 100644
--- a/base/observer_list_threadsafe.h
+++ b/base/observer_list_threadsafe.h
@@ -81,11 +81,15 @@ class ObserverListThreadSafe :
void RemoveObserver(ObserverType* obs) {
ObserverList<ObserverType>* list = NULL;
MessageLoop* loop = MessageLoop::current();
+ if (!loop)
+ return; // On shutdown, it is possible that current() is already null.
{
AutoLock lock(list_lock_);
- DCHECK(observer_lists_.find(loop) != observer_lists_.end()) <<
- "RemoveObserver called on for unknown thread";
list = observer_lists_[loop];
+ if (!list) {
+ NOTREACHED() << "RemoveObserver called on for unknown thread";
+ return;
+ }
// If we're about to remove the last observer from the list,
// then we can remove this observer_list entirely.