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 "platform/scheduler/base/task_queue_manager.h" | 5 #include "platform/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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 UpdateWorkQueues(&lazy_now); | 285 UpdateWorkQueues(&lazy_now); |
286 | 286 |
287 internal::WorkQueue* work_queue = nullptr; | 287 internal::WorkQueue* work_queue = nullptr; |
288 if (!SelectWorkQueueToService(&work_queue)) | 288 if (!SelectWorkQueueToService(&work_queue)) |
289 break; | 289 break; |
290 | 290 |
291 // NB this may unregister the queue. | 291 // NB this may unregister the queue. |
292 switch (ProcessTaskFromWorkQueue(work_queue, is_nested, &lazy_now)) { | 292 switch (ProcessTaskFromWorkQueue(work_queue, is_nested, &lazy_now)) { |
293 case ProcessTaskResult::DEFERRED: | 293 case ProcessTaskResult::DEFERRED: |
294 // If a task was deferred, try again with another task. | 294 // If a task was deferred, try again with another task. |
| 295 DCHECK(delegate_->IsNested()); |
295 continue; | 296 continue; |
296 case ProcessTaskResult::EXECUTED: | 297 case ProcessTaskResult::EXECUTED: |
297 break; | 298 break; |
298 case ProcessTaskResult::TASK_QUEUE_MANAGER_DELETED: | 299 case ProcessTaskResult::TASK_QUEUE_MANAGER_DELETED: |
299 return; // The TaskQueueManager got deleted, we must bail out. | 300 return; // The TaskQueueManager got deleted, we must bail out. |
300 } | 301 } |
301 | 302 |
302 // Only run a single task per batch in nested run loops so that we can | 303 // Only run a single task per batch in nested run loops so that we can |
303 // properly exit the nested loop when someone calls RunLoop::Quit(). | 304 // properly exit the nested loop when someone calls RunLoop::Quit(). |
304 if (is_nested) | 305 if (is_nested) |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 } | 637 } |
637 | 638 |
638 void TaskQueueManager::SetRecordTaskDelayHistograms( | 639 void TaskQueueManager::SetRecordTaskDelayHistograms( |
639 bool record_task_delay_histograms) { | 640 bool record_task_delay_histograms) { |
640 DCHECK(main_thread_checker_.CalledOnValidThread()); | 641 DCHECK(main_thread_checker_.CalledOnValidThread()); |
641 record_task_delay_histograms_ = record_task_delay_histograms; | 642 record_task_delay_histograms_ = record_task_delay_histograms; |
642 } | 643 } |
643 | 644 |
644 } // namespace scheduler | 645 } // namespace scheduler |
645 } // namespace blink | 646 } // namespace blink |
OLD | NEW |