Chromium Code Reviews| Index: base/message_loop/message_loop.h |
| diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h |
| index 8ef8d6a21fff5ffb914ddcc7a1e7202acc4fa9cd..b785abf4958bcc7021c0cf386e3df4739c51a068 100644 |
| --- a/base/message_loop/message_loop.h |
| +++ b/base/message_loop/message_loop.h |
| @@ -399,6 +399,15 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { |
| protected: |
| scoped_ptr<MessagePump> pump_; |
| + using MessagePumpFactoryCallback = Callback<scoped_ptr<MessagePump>()>; |
| + |
| + // Common protected constructor. Other constructors delegate the |
| + // initialization to this constructor. |
| + MessageLoop(Type type, MessagePumpFactoryCallback pump_factory); |
| + |
| + // Configure various members and bind this message loop to the current thread. |
|
Mark Mentovai
2016/01/25 14:54:54
Since this is now protected, you should say when a
|
| + void BindToCurrentThread(); |
| + |
| private: |
| friend class RunLoop; |
| friend class internal::IncomingTaskQueue; |
| @@ -406,8 +415,6 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { |
| friend class Thread; |
| FRIEND_TEST_ALL_PREFIXES(MessageLoopTest, DeleteUnboundLoop); |
| - using MessagePumpFactoryCallback = Callback<scoped_ptr<MessagePump>()>; |
| - |
| // Creates a MessageLoop without binding to a thread. |
| // If |type| is TYPE_CUSTOM non-null |pump_factory| must be also given |
| // to create a message pump for this message loop. Otherwise a default |
| @@ -423,13 +430,6 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { |
| Type type, |
| MessagePumpFactoryCallback pump_factory); |
| - // Common private constructor. Other constructors delegate the initialization |
| - // to this constructor. |
| - MessageLoop(Type type, MessagePumpFactoryCallback pump_factory); |
| - |
| - // Configure various members and bind this message loop to the current thread. |
| - void BindToCurrentThread(); |
| - |
| // Sets the ThreadTaskRunnerHandle for the current thread to point to the |
| // task runner for this message loop. |
| void SetThreadTaskRunnerHandle(); |
| @@ -563,17 +563,19 @@ class BASE_EXPORT MessageLoopForUI : public MessageLoop { |
| MessageLoopForUI() : MessageLoop(TYPE_UI) { |
| } |
| + explicit MessageLoopForUI(scoped_ptr<MessagePump> pump); |
| + |
| // Returns the MessageLoopForUI of the current thread. |
| static MessageLoopForUI* current() { |
| MessageLoop* loop = MessageLoop::current(); |
| DCHECK(loop); |
| - DCHECK_EQ(MessageLoop::TYPE_UI, loop->type()); |
| + DCHECK(loop->IsType(MessageLoop::TYPE_UI)); |
| return static_cast<MessageLoopForUI*>(loop); |
| } |
| static bool IsCurrent() { |
| MessageLoop* loop = MessageLoop::current(); |
| - return loop && loop->type() == MessageLoop::TYPE_UI; |
| + return loop && loop->IsType(MessageLoop::TYPE_UI); |
| } |
| #if defined(OS_IOS) |