OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/scheduler/base/task_queue_manager.h" | 5 #include "components/scheduler/base/task_queue_manager.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 for (int i = 0; i < work_batch_size_; i++) { | 209 for (int i = 0; i < work_batch_size_; i++) { |
210 internal::WorkQueue* work_queue; | 210 internal::WorkQueue* work_queue; |
211 if (!SelectWorkQueueToService(&work_queue)) { | 211 if (!SelectWorkQueueToService(&work_queue)) { |
212 break; | 212 break; |
213 } | 213 } |
214 | 214 |
215 bool should_trigger_wakeup = work_queue->task_queue()->wakeup_policy() == | 215 bool should_trigger_wakeup = work_queue->task_queue()->wakeup_policy() == |
216 TaskQueue::WakeupPolicy::CAN_WAKE_OTHER_QUEUES; | 216 TaskQueue::WakeupPolicy::CAN_WAKE_OTHER_QUEUES; |
217 | 217 |
218 switch (ProcessTaskFromWorkQueue(work_queue, &previous_task)) { | 218 if (!delegate_->IsNested() && task_time_tracker_) |
| 219 fprintf(stderr, "\n[ TaskQueueMgr::willProcessTask "); |
| 220 |
| 221 ProcessTaskResult result = ProcessTaskFromWorkQueue(work_queue, &previous_ta
sk); |
| 222 |
| 223 if (!delegate_->IsNested() && task_time_tracker_) |
| 224 fprintf(stderr, "TaskQueueMgr::didProcessTask ]\n"); |
| 225 |
| 226 switch (result) { |
219 case ProcessTaskResult::DEFERRED: | 227 case ProcessTaskResult::DEFERRED: |
220 // If a task was deferred, try again with another task. Note that this | 228 // If a task was deferred, try again with another task. Note that this |
221 // means deferred tasks (i.e. non-nestable tasks) will never trigger | 229 // means deferred tasks (i.e. non-nestable tasks) will never trigger |
222 // queue wake-ups. | 230 // queue wake-ups. |
223 continue; | 231 continue; |
224 case ProcessTaskResult::EXECUTED: | 232 case ProcessTaskResult::EXECUTED: |
225 break; | 233 break; |
226 case ProcessTaskResult::TASK_QUEUE_MANAGER_DELETED: | 234 case ProcessTaskResult::TASK_QUEUE_MANAGER_DELETED: |
227 return; // The TaskQueueManager got deleted, we must bail out. | 235 return; // The TaskQueueManager got deleted, we must bail out. |
228 } | 236 } |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 internal::WorkQueue* work_queue) { | 441 internal::WorkQueue* work_queue) { |
434 DCHECK(main_thread_checker_.CalledOnValidThread()); | 442 DCHECK(main_thread_checker_.CalledOnValidThread()); |
435 DCHECK(!work_queue->Empty()); | 443 DCHECK(!work_queue->Empty()); |
436 if (observer_) { | 444 if (observer_) { |
437 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), | 445 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), |
438 *work_queue->GetFrontTask()); | 446 *work_queue->GetFrontTask()); |
439 } | 447 } |
440 } | 448 } |
441 | 449 |
442 } // namespace scheduler | 450 } // namespace scheduler |
OLD | NEW |