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..0d2d6b0058a2f2ae3bf946de123bb569d36e8f6d 100644 |
--- a/base/message_loop/incoming_task_queue.h |
+++ b/base/message_loop/incoming_task_queue.h |
@@ -26,6 +26,11 @@ class BASE_EXPORT IncomingTaskQueue |
public: |
explicit IncomingTaskQueue(MessageLoop* message_loop); |
+ // Creates a task queue for the message loop that is to be initialized lazily |
+ // (i.e. created by CreateForLazyInit()). |
rvargas (doing something else)
2015/03/26 02:19:26
nit: try to keep cross-refs to a minimum (as in do
kinuko
2015/04/13 02:02:59
Done.
|
+ static IncomingTaskQueue* CreateForLazyInitMessageLoop( |
rvargas (doing something else)
2015/03/26 02:19:26
return a scoped ptr (and same comment about this n
kinuko
2015/04/13 02:02:59
Done. (This is ref-counted so returning scoped_ref
|
+ 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 |
// task is properly synchronized between different threads. |
@@ -53,6 +58,13 @@ class BASE_EXPORT IncomingTaskQueue |
// Disconnects |this| from the parent message loop. |
void WillDestroyCurrentMessageLoop(); |
+ // Called when |message_loop_|'s LazyInit() is called, so that now it's ready |
+ // for scheduling work. It is not valid to call this unless this task queue |
+ // is created by CreateForLazyInitMessageLoop(). |
+ void DidInitializeMessageLoop(); |
rvargas (doing something else)
2015/03/26 02:19:26
Maybe StartScheduling() ?
kinuko
2015/04/13 02:02:59
Done.
|
+ |
+ bool empty(); |
rvargas (doing something else)
2015/03/26 02:19:26
nit: doc
kinuko
2015/04/13 02:02:59
Done.
|
+ |
private: |
friend class RefCountedThreadSafe<IncomingTaskQueue>; |
virtual ~IncomingTaskQueue(); |
@@ -92,6 +104,11 @@ class BASE_EXPORT IncomingTaskQueue |
// if the incoming queue was not empty. |
const bool always_schedule_work_; |
+ // True if our message loop is created for lazy initialization and hasn't been |
+ // initialized yet. Note that while this is true this task queue won't call |
+ // ScheduleWork even if always_schedule_work_ is true. |
+ bool message_loop_not_initialized_ = false; |
+ |
DISALLOW_COPY_AND_ASSIGN(IncomingTaskQueue); |
}; |