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 "content/child/scheduler/task_queue_manager.h" | 5 #include "content/child/scheduler/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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 return true; | 296 return true; |
| 297 } | 297 } |
| 298 | 298 |
| 299 bool TaskQueue::UpdateWorkQueue(LazyNow* lazy_now, | 299 bool TaskQueue::UpdateWorkQueue(LazyNow* lazy_now, |
| 300 const base::PendingTask* previous_task) { | 300 const base::PendingTask* previous_task) { |
| 301 if (!work_queue_.empty()) | 301 if (!work_queue_.empty()) |
| 302 return true; | 302 return true; |
| 303 | 303 |
| 304 { | 304 { |
| 305 base::AutoLock lock(lock_); | 305 base::AutoLock lock(lock_); |
| 306 MoveReadyDelayedTasksToIncomingQueueLocked(lazy_now); | 306 MoveReadyDelayedTasksToIncomingQueueLocked(lazy_now); |
|
Sami
2015/04/07 12:41:30
Should we do this after the pump check instead? Th
alex clarke (OOO till 29th)
2015/04/08 10:00:30
Done.
| |
| 307 if (!ShouldAutoPumpQueueLocked(previous_task)) | 307 if (!ShouldAutoPumpQueueLocked(previous_task)) |
| 308 return false; | 308 return false; |
| 309 MoveReadyDelayedTasksToIncomingQueueLocked(lazy_now); | |
| 310 work_queue_.Swap(&incoming_queue_); | 309 work_queue_.Swap(&incoming_queue_); |
| 311 TraceQueueSize(true); | 310 TraceQueueSize(true); |
| 312 return true; | 311 return true; |
| 313 } | 312 } |
| 314 } | 313 } |
| 315 | 314 |
| 316 base::PendingTask TaskQueue::TakeTaskFromWorkQueue() { | 315 base::PendingTask TaskQueue::TakeTaskFromWorkQueue() { |
| 317 base::PendingTask pending_task = work_queue_.front(); | 316 base::PendingTask pending_task = work_queue_.front(); |
| 318 work_queue_.pop(); | 317 work_queue_.pop(); |
| 319 TraceQueueSize(false); | 318 TraceQueueSize(false); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 705 state->EndArray(); | 704 state->EndArray(); |
| 706 state->BeginDictionary("selector"); | 705 state->BeginDictionary("selector"); |
| 707 selector_->AsValueInto(state.get()); | 706 selector_->AsValueInto(state.get()); |
| 708 state->EndDictionary(); | 707 state->EndDictionary(); |
| 709 if (should_run) | 708 if (should_run) |
| 710 state->SetInteger("selected_queue", selected_queue); | 709 state->SetInteger("selected_queue", selected_queue); |
| 711 return state; | 710 return state; |
| 712 } | 711 } |
| 713 | 712 |
| 714 } // namespace content | 713 } // namespace content |
| OLD | NEW |