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

Unified Diff: base/message_loop/incoming_task_queue.h

Issue 1058603004: [Approach 3] Pre-allocate IncomigTaskQueue before MessageLoop for faster thread startup Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | base/message_loop/incoming_task_queue.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/incoming_task_queue.h
diff --git a/base/message_loop/incoming_task_queue.h b/base/message_loop/incoming_task_queue.h
index 72e1f30282966de72b01a505a6144839a1d00643..193ff7a160ae8e22e5f319024485dd2b84364729 100644
--- a/base/message_loop/incoming_task_queue.h
+++ b/base/message_loop/incoming_task_queue.h
@@ -6,6 +6,7 @@
#define BASE_MESSAGE_LOOP_INCOMING_TASK_QUEUE_H_
#include "base/base_export.h"
+#include "base/debug/task_annotator.h"
#include "base/memory/ref_counted.h"
#include "base/pending_task.h"
#include "base/synchronization/lock.h"
@@ -24,7 +25,11 @@ namespace internal {
class BASE_EXPORT IncomingTaskQueue
: public RefCountedThreadSafe<IncomingTaskQueue> {
public:
- explicit IncomingTaskQueue(MessageLoop* message_loop);
+ IncomingTaskQueue();
+
+ // Associates the |message_loop| to this task queue and starts scheduling
+ // tasks.
+ void StartScheduling(MessageLoop* message_loop);
// Appends a task to the incoming queue. Posting of all tasks is routed though
// AddToIncomingQueue() or TryAddToIncomingQueue() to make sure that posting
@@ -53,6 +58,10 @@ class BASE_EXPORT IncomingTaskQueue
// Disconnects |this| from the parent message loop.
void WillDestroyCurrentMessageLoop();
+ // Returns the TaskAnnotator which is used to add debug information to posted
+ // tasks.
+ debug::TaskAnnotator* task_annotator() { return &task_annotator_; }
+
private:
friend class RefCountedThreadSafe<IncomingTaskQueue>;
virtual ~IncomingTaskQueue();
@@ -86,11 +95,16 @@ class BASE_EXPORT IncomingTaskQueue
// True if our message loop has already been scheduled and does not need to be
// scheduled again until an empty reload occurs.
- bool message_loop_scheduled_;
+ bool message_loop_scheduled_ = false;
+
+ // True after WillDestroyCurrentMessageLoop is called.
+ bool message_loop_terminated_ = false;
// True if we always need to call ScheduleWork when receiving a new task, even
// if the incoming queue was not empty.
- const bool always_schedule_work_;
+ bool always_schedule_work_ = false;
+
+ debug::TaskAnnotator task_annotator_;
DISALLOW_COPY_AND_ASSIGN(IncomingTaskQueue);
};
« no previous file with comments | « no previous file | base/message_loop/incoming_task_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698