Chromium Code Reviews| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 | 294 |
| 295 // Detect if the TaskQueueManager just got deleted. If this happens we must | 295 // Detect if the TaskQueueManager just got deleted. If this happens we must |
| 296 // not access any member variables after this point. | 296 // not access any member variables after this point. |
| 297 if (protect->HasOneRef()) | 297 if (protect->HasOneRef()) |
| 298 return true; | 298 return true; |
| 299 | 299 |
| 300 if (queue->GetShouldNotifyObservers()) { | 300 if (queue->GetShouldNotifyObservers()) { |
| 301 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, | 301 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, |
| 302 DidProcessTask(pending_task)); | 302 DidProcessTask(pending_task)); |
| 303 } | 303 } |
| 304 } | |
| 304 | 305 |
| 305 pending_task.task.Reset(); | 306 pending_task.task.Reset(); |
| 306 *out_previous_task = pending_task; | 307 *out_previous_task = pending_task; |
|
Sami
2015/08/12 11:47:51
Hmm, should we just ignore out_previous_task if we
rmcilroy
2015/08/12 13:08:27
As discussed offline, this might be our only chanc
| |
| 307 } | |
| 308 return false; | 308 return false; |
| 309 } | 309 } |
| 310 | 310 |
| 311 bool TaskQueueManager::RunsTasksOnCurrentThread() const { | 311 bool TaskQueueManager::RunsTasksOnCurrentThread() const { |
| 312 return main_task_runner_->RunsTasksOnCurrentThread(); | 312 return main_task_runner_->RunsTasksOnCurrentThread(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 bool TaskQueueManager::PostDelayedTask( | 315 bool TaskQueueManager::PostDelayedTask( |
| 316 const tracked_objects::Location& from_here, | 316 const tracked_objects::Location& from_here, |
| 317 const base::Closure& task, | 317 const base::Closure& task, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 383 } | 383 } |
| 384 | 384 |
| 385 void TaskQueueManager::OnTaskQueueEnabled(internal::TaskQueueImpl* queue) { | 385 void TaskQueueManager::OnTaskQueueEnabled(internal::TaskQueueImpl* queue) { |
| 386 DCHECK(main_thread_checker_.CalledOnValidThread()); | 386 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 387 // Only schedule DoWork if there's something to do. | 387 // Only schedule DoWork if there's something to do. |
| 388 if (!queue->work_queue().empty()) | 388 if (!queue->work_queue().empty()) |
| 389 MaybePostDoWorkOnMainRunner(); | 389 MaybePostDoWorkOnMainRunner(); |
| 390 } | 390 } |
| 391 | 391 |
| 392 } // namespace scheduler | 392 } // namespace scheduler |
| OLD | NEW |