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); |
}; |