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

Unified Diff: base/message_loop/message_loop.h

Issue 1582123002: Augment message_loop with ability for custom UI message pumps (issue 576536) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add name to Authors file Created 4 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 | « AUTHORS ('k') | base/message_loop/message_loop.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 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)
« no previous file with comments | « AUTHORS ('k') | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698