| 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 queue->NotifyWillProcessTask(pending_task); | 327 queue->NotifyWillProcessTask(pending_task); |
| 328 } | 328 } |
| 329 TRACE_EVENT1(tracing_category_, "TaskQueueManager::RunTask", "queue", | 329 TRACE_EVENT1(tracing_category_, "TaskQueueManager::RunTask", "queue", |
| 330 queue->GetName()); | 330 queue->GetName()); |
| 331 // NOTE when TaskQueues get unregistered a reference ends up getting retained | 331 // NOTE when TaskQueues get unregistered a reference ends up getting retained |
| 332 // by |queues_to_delete_| which is cleared at the top of |DoWork|. This means | 332 // by |queues_to_delete_| which is cleared at the top of |DoWork|. This means |
| 333 // we are OK to use raw pointers here. | 333 // we are OK to use raw pointers here. |
| 334 internal::TaskQueueImpl* prev_executing_task_queue = | 334 internal::TaskQueueImpl* prev_executing_task_queue = |
| 335 currently_executing_task_queue_; | 335 currently_executing_task_queue_; |
| 336 currently_executing_task_queue_ = queue; | 336 currently_executing_task_queue_ = queue; |
| 337 task_annotator_.RunTask("TaskQueueManager::PostTask", pending_task); | 337 task_annotator_.RunTask("TaskQueueManager::PostTask", &pending_task); |
| 338 // Detect if the TaskQueueManager just got deleted. If this happens we must | 338 // Detect if the TaskQueueManager just got deleted. If this happens we must |
| 339 // not access any member variables after this point. | 339 // not access any member variables after this point. |
| 340 if (protect->HasOneRef()) | 340 if (protect->HasOneRef()) |
| 341 return ProcessTaskResult::TASK_QUEUE_MANAGER_DELETED; | 341 return ProcessTaskResult::TASK_QUEUE_MANAGER_DELETED; |
| 342 | 342 |
| 343 currently_executing_task_queue_ = prev_executing_task_queue; | 343 currently_executing_task_queue_ = prev_executing_task_queue; |
| 344 | 344 |
| 345 if (queue->GetShouldNotifyObservers()) { | 345 if (queue->GetShouldNotifyObservers()) { |
| 346 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, | 346 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, |
| 347 DidProcessTask(pending_task)); | 347 DidProcessTask(pending_task)); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 DCHECK(main_thread_checker_.CalledOnValidThread()); | 458 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 459 DCHECK(!work_queue->Empty()); | 459 DCHECK(!work_queue->Empty()); |
| 460 if (observer_) { | 460 if (observer_) { |
| 461 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), | 461 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), |
| 462 *work_queue->GetFrontTask()); | 462 *work_queue->GetFrontTask()); |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 | 465 |
| 466 } // namespace scheduler | 466 } // namespace scheduler |
| 467 } // namespace blink | 467 } // namespace blink |
| OLD | NEW |