diff options
Diffstat (limited to 'base/message_loop/message_loop.h')
-rw-r--r-- | base/message_loop/message_loop.h | 10 |
1 files changed, 10 insertions, 0 deletions
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 @@ 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); } |