| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 break; | 243 break; |
| 244 case ProcessTaskResult::TASK_QUEUE_MANAGER_DELETED: | 244 case ProcessTaskResult::TASK_QUEUE_MANAGER_DELETED: |
| 245 return; // The TaskQueueManager got deleted, we must bail out. | 245 return; // The TaskQueueManager got deleted, we must bail out. |
| 246 } | 246 } |
| 247 | 247 |
| 248 lazy_now = real_time_domain()->CreateLazyNow(); | 248 lazy_now = real_time_domain()->CreateLazyNow(); |
| 249 if (!delegate_->IsNested() && task_start_time != base::TimeTicks()) { | 249 if (!delegate_->IsNested() && task_start_time != base::TimeTicks()) { |
| 250 // Only report top level task durations. | 250 // Only report top level task durations. |
| 251 base::TimeTicks task_end_time = lazy_now.Now(); | 251 base::TimeTicks task_end_time = lazy_now.Now(); |
| 252 FOR_EACH_OBSERVER(TaskTimeObserver, task_time_observers_, | 252 FOR_EACH_OBSERVER(TaskTimeObserver, task_time_observers_, |
| 253 ReportTaskTime(MonotonicTimeInSeconds(task_start_time), | 253 ReportTaskTime(work_queue->task_queue(), |
| 254 MonotonicTimeInSeconds(task_start_time), |
| 254 MonotonicTimeInSeconds(task_end_time))); | 255 MonotonicTimeInSeconds(task_end_time))); |
| 255 task_start_time = task_end_time; | 256 task_start_time = task_end_time; |
| 256 } | 257 } |
| 257 | 258 |
| 258 work_queue = nullptr; // The queue may have been unregistered. | 259 work_queue = nullptr; // The queue may have been unregistered. |
| 259 | 260 |
| 260 UpdateWorkQueues(lazy_now); | 261 UpdateWorkQueues(lazy_now); |
| 261 | 262 |
| 262 // Only run a single task per batch in nested run loops so that we can | 263 // Only run a single task per batch in nested run loops so that we can |
| 263 // properly exit the nested loop when someone calls RunLoop::Quit(). | 264 // properly exit the nested loop when someone calls RunLoop::Quit(). |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 DCHECK(main_thread_checker_.CalledOnValidThread()); | 463 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 463 DCHECK(!work_queue->Empty()); | 464 DCHECK(!work_queue->Empty()); |
| 464 if (observer_) { | 465 if (observer_) { |
| 465 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), | 466 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), |
| 466 *work_queue->GetFrontTask()); | 467 *work_queue->GetFrontTask()); |
| 467 } | 468 } |
| 468 } | 469 } |
| 469 | 470 |
| 470 } // namespace scheduler | 471 } // namespace scheduler |
| 471 } // namespace blink | 472 } // namespace blink |
| OLD | NEW |