| 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/child/task_queue_manager.h" | 5 #include "components/scheduler/child/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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 scoped_refptr<DeletionSentinel> protect(deletion_sentinel_); | 274 scoped_refptr<DeletionSentinel> protect(deletion_sentinel_); |
| 275 // TODO(alexclarke): consider std::move() when allowed. | 275 // TODO(alexclarke): consider std::move() when allowed. |
| 276 internal::TaskQueueImpl::Task pending_task = queue->TakeTaskFromWorkQueue(); | 276 internal::TaskQueueImpl::Task pending_task = queue->TakeTaskFromWorkQueue(); |
| 277 | 277 |
| 278 if (queue->GetQuiescenceMonitored()) | 278 if (queue->GetQuiescenceMonitored()) |
| 279 task_was_run_on_quiescence_monitored_queue_ = true; | 279 task_was_run_on_quiescence_monitored_queue_ = true; |
| 280 | 280 |
| 281 if (!pending_task.nestable && main_task_runner_->IsNested()) { | 281 if (!pending_task.nestable && main_task_runner_->IsNested()) { |
| 282 // Defer non-nestable work to the main task runner. NOTE these tasks can be | 282 // Defer non-nestable work to the main task runner. NOTE these tasks can be |
| 283 // arbitrarily delayed so the additional delay should not be a problem. | 283 // arbitrarily delayed so the additional delay should not be a problem. |
| 284 // TODO(skyostil): Figure out a way to not forget which task queue the |
| 285 // task is associated with. See http://crbug.com/522843. |
| 284 main_task_runner_->PostNonNestableTask(pending_task.posted_from, | 286 main_task_runner_->PostNonNestableTask(pending_task.posted_from, |
| 285 pending_task.task); | 287 pending_task.task); |
| 286 } else { | 288 } else { |
| 287 TRACE_TASK_EXECUTION("TaskQueueManager::ProcessTaskFromWorkQueue", | 289 TRACE_TASK_EXECUTION("TaskQueueManager::ProcessTaskFromWorkQueue", |
| 288 pending_task); | 290 pending_task); |
| 289 if (queue->GetShouldNotifyObservers()) { | 291 if (queue->GetShouldNotifyObservers()) { |
| 290 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, | 292 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, |
| 291 WillProcessTask(pending_task)); | 293 WillProcessTask(pending_task)); |
| 292 } | 294 } |
| 293 task_annotator_.RunTask("TaskQueueManager::PostTask", pending_task); | 295 task_annotator_.RunTask("TaskQueueManager::PostTask", pending_task); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 } | 385 } |
| 384 | 386 |
| 385 void TaskQueueManager::OnTaskQueueEnabled(internal::TaskQueueImpl* queue) { | 387 void TaskQueueManager::OnTaskQueueEnabled(internal::TaskQueueImpl* queue) { |
| 386 DCHECK(main_thread_checker_.CalledOnValidThread()); | 388 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 387 // Only schedule DoWork if there's something to do. | 389 // Only schedule DoWork if there's something to do. |
| 388 if (!queue->work_queue().empty()) | 390 if (!queue->work_queue().empty()) |
| 389 MaybePostDoWorkOnMainRunner(); | 391 MaybePostDoWorkOnMainRunner(); |
| 390 } | 392 } |
| 391 | 393 |
| 392 } // namespace scheduler | 394 } // namespace scheduler |
| OLD | NEW |