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

Unified Diff: base/message_loop/message_loop.h

Issue 1140363002: Revert of Reland: Lazily initialize MessageLoop for faster thread startup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « base/message_loop/incoming_task_queue.cc ('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 f2f89d0574dc05f70102cc592fa0250860e13031..fd7596a79204ed89291f32b2f9135108a73b2882 100644
--- a/base/message_loop/message_loop.h
+++ b/base/message_loop/message_loop.h
@@ -114,8 +114,7 @@
explicit MessageLoop(Type type = TYPE_DEFAULT);
// Creates a TYPE_CUSTOM MessageLoop with the supplied MessagePump, which must
// be non-NULL.
- explicit MessageLoop(scoped_ptr<MessagePump> pump);
-
+ explicit MessageLoop(scoped_ptr<base::MessagePump> pump);
~MessageLoop() override;
// Returns the MessageLoop object for the current thread, or null if none.
@@ -395,6 +394,10 @@
// Returns true if the message loop is "idle". Provided for testing.
bool IsIdleForTesting();
+ // Wakes up the message pump. Can be called on any thread. The caller is
+ // responsible for synchronizing ScheduleWork() calls.
+ void ScheduleWork();
+
// Returns the TaskAnnotator which is used to add debug information to posted
// tasks.
debug::TaskAnnotator* task_annotator() { return &task_annotator_; }
@@ -408,33 +411,9 @@
private:
friend class RunLoop;
- friend class internal::IncomingTaskQueue;
- friend class ScheduleWorkTest;
- friend class Thread;
-
- 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
- // message pump for the |type| is created.
- //
- // It is valid to call this to create a new message loop on one thread,
- // and then pass it to the thread where the message loop actually runs.
- // The message loop's BindToCurrentThread() method must be called on the
- // thread the message loop runs on, before calling Run().
- // Before BindToCurrentThread() is called only Post*Task() functions can
- // be called on the message loop.
- scoped_ptr<MessageLoop> CreateUnbound(
- 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();
+
+ // Configures various members for the two constructors.
+ void Init();
// Invokes the actual run loop using the message pump.
void RunHandler();
@@ -457,10 +436,6 @@
// Loads tasks from the incoming queue to |work_queue_| if the latter is
// empty.
void ReloadWorkQueue();
-
- // Wakes up the message pump. Can be called on any thread. The caller is
- // responsible for synchronizing ScheduleWork() calls.
- void ScheduleWork();
// Start recording histogram info about events and action IF it was enabled
// and IF the statistics recorder can accept a registration of our histogram.
@@ -514,10 +489,6 @@
// which enter a modal message loop.
bool os_modal_loop_;
#endif
-
- // pump_factory_.Run() is called to create a message pump for this loop
- // if type_ is TYPE_CUSTOM and pump_ is null.
- MessagePumpFactoryCallback pump_factory_;
std::string thread_name_;
// A profiling histogram showing the counts of various messages and events.
« no previous file with comments | « base/message_loop/incoming_task_queue.cc ('k') | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698