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

Unified Diff: base/observer_list_threadsafe.h

Issue 2136563002: Remove calls to MessageLoop::current() in base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restore dns_config_service_posix_unittest.cc Created 4 years, 5 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 | « no previous file | base/power_monitor/power_monitor_device_source.cc » ('j') | base/threading/thread.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/observer_list_threadsafe.h
diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h
index fe783542f47a3903c1c5131439bc4712bfc6ea25..5174667e603157656feabe4d7cc94eab80421902 100644
--- a/base/observer_list_threadsafe.h
+++ b/base/observer_list_threadsafe.h
@@ -14,7 +14,6 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/message_loop/message_loop.h"
#include "base/observer_list.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
@@ -113,9 +112,9 @@ class ObserverListThreadSafe
// Add an observer to the list. An observer should not be added to
// the same list more than once.
void AddObserver(ObserverType* obs) {
- // If there is not a current MessageLoop, it is impossible to notify on it,
+ // If there is no ThreadTaskRunnerHandle, it is impossible to notify on it,
// so do not add the observer.
- if (!MessageLoop::current())
+ if (!ThreadTaskRunnerHandle::IsSet())
return;
ObserverList<ObserverType>* list = nullptr;
@@ -256,8 +255,9 @@ class ObserverListThreadSafe
}
// Key by PlatformThreadId because in tests, clients can attempt to remove
- // observers without a MessageLoop. If this were keyed by MessageLoop, that
- // operation would be silently ignored, leaving garbage in the ObserverList.
+ // observers without a SingleThreadTaskRunner. If this were keyed by
+ // SingleThreadTaskRunner, that operation would be silently ignored, leaving
+ // garbage in the ObserverList.
typedef std::map<PlatformThreadId, ObserverListContext*>
ObserversListMap;
« no previous file with comments | « no previous file | base/power_monitor/power_monitor_device_source.cc » ('j') | base/threading/thread.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698