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

Unified Diff: base/observer_list_threadsafe.h

Issue 4288: Make the SystemMonitor observer list thread safe.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 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 | « no previous file | base/system_monitor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/observer_list_threadsafe.h
===================================================================
--- base/observer_list_threadsafe.h (revision 4449)
+++ base/observer_list_threadsafe.h (working copy)
@@ -81,11 +81,15 @@
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.
« no previous file with comments | « no previous file | base/system_monitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698