| 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..499e1942827e5aa1faecc57c67a0363dd63f5728 100644
|
| --- a/base/message_loop/message_loop.h
|
| +++ b/base/message_loop/message_loop.h
|
| @@ -399,6 +399,19 @@ 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.
|
| + // A subclass can invoke this constructor to create a message_loop of a
|
| + // specific type with a custom loop. The implementation does not call
|
| + // BindToCurrentThread. If this constructor is invoked directly by a subclass,
|
| + // then the subclass must subsequently bind the message loop.
|
| + MessageLoop(Type type, MessagePumpFactoryCallback pump_factory);
|
| +
|
| + // Configure various members and bind this message loop to the current thread.
|
| + void BindToCurrentThread();
|
| +
|
| private:
|
| friend class RunLoop;
|
| friend class internal::IncomingTaskQueue;
|
| @@ -406,8 +419,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 +434,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 +567,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)
|
|
|