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

Unified Diff: base/message_loop/message_loop.h

Issue 141683005: Removes MessageLoop::Type checks in favor of IsCurrent on MessageLoops. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: base:: Created 6 years, 11 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_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_loop.h
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h
index 74eddaf2fc9f694bc8368bc7e64f8752a905aaef..2388b59b88e41d058887ec6919950caf1e41caca 100644
--- a/base/message_loop/message_loop.h
+++ b/base/message_loop/message_loop.h
@@ -565,6 +565,11 @@ class BASE_EXPORT MessageLoopForUI : public MessageLoop {
return static_cast<MessageLoopForUI*>(loop);
}
+ static bool IsCurrent() {
+ MessageLoop* loop = MessageLoop::current();
+ return loop && loop->type() == MessageLoop::TYPE_UI;
+ }
+
#if defined(OS_IOS)
// On iOS, the main message loop cannot be Run(). Instead call Attach(),
// which connects this MessageLoop to the UI thread's CFRunLoop and allows
@@ -664,6 +669,11 @@ class BASE_EXPORT MessageLoopForIO : public MessageLoop {
return static_cast<MessageLoopForIO*>(loop);
}
+ static bool IsCurrent() {
+ MessageLoop* loop = MessageLoop::current();
+ return loop && loop->type() == MessageLoop::TYPE_IO;
+ }
+
void AddIOObserver(IOObserver* io_observer) {
pump_io()->AddIOObserver(io_observer);
}
« no previous file with comments | « no previous file | base/power_monitor/power_monitor_device_source_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698