Removes MessageLoop::Type checks in favor of IsCurrent on MessageLoops.
This is part of removing the MessageLoop::Type enum.
BUG=none
TEST=none
R=darin@chromium.org
Review URL: https://codereview.chromium.org/141683005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245882 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 9d434e21296a0e506552e3a660101efa3403a2fe
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h
index 74eddaf..2388b59 100644
--- a/base/message_loop/message_loop.h
+++ b/base/message_loop/message_loop.h
@@ -565,6 +565,11 @@
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 @@
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);
}