OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/message_loop/incoming_task_queue.h" | 5 #include "base/message_loop/incoming_task_queue.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 if (!message_loop_) { | 123 if (!message_loop_) { |
124 pending_task->task.Reset(); | 124 pending_task->task.Reset(); |
125 return false; | 125 return false; |
126 } | 126 } |
127 | 127 |
128 // Initialize the sequence number. The sequence number is used for delayed | 128 // Initialize the sequence number. The sequence number is used for delayed |
129 // tasks (to faciliate FIFO sorting when two tasks have the same | 129 // tasks (to faciliate FIFO sorting when two tasks have the same |
130 // delayed_run_time value) and for identifying the task in about:tracing. | 130 // delayed_run_time value) and for identifying the task in about:tracing. |
131 pending_task->sequence_num = next_sequence_num_++; | 131 pending_task->sequence_num = next_sequence_num_++; |
132 | 132 |
133 TRACE_EVENT_FLOW_BEGIN0("task", "MessageLoop::PostTask", | 133 TRACE_EVENT_FLOW_BEGIN0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), |
| 134 "MessageLoop::PostTask", |
134 TRACE_ID_MANGLE(message_loop_->GetTaskTraceID(*pending_task))); | 135 TRACE_ID_MANGLE(message_loop_->GetTaskTraceID(*pending_task))); |
135 | 136 |
136 bool was_empty = incoming_queue_.empty(); | 137 bool was_empty = incoming_queue_.empty(); |
137 incoming_queue_.push(*pending_task); | 138 incoming_queue_.push(*pending_task); |
138 pending_task->task.Reset(); | 139 pending_task->task.Reset(); |
139 | 140 |
140 // Wake up the pump. | 141 // Wake up the pump. |
141 message_loop_->ScheduleWork(was_empty); | 142 message_loop_->ScheduleWork(was_empty); |
142 | 143 |
143 return true; | 144 return true; |
144 } | 145 } |
145 | 146 |
146 } // namespace internal | 147 } // namespace internal |
147 } // namespace base | 148 } // namespace base |
OLD | NEW |