| 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/base/task_queue_manager.h" | 5 #include "components/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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 state->BeginDictionary("selector"); | 383 state->BeginDictionary("selector"); |
| 384 selector_.AsValueInto(state.get()); | 384 selector_.AsValueInto(state.get()); |
| 385 state->EndDictionary(); | 385 state->EndDictionary(); |
| 386 if (should_run) { | 386 if (should_run) { |
| 387 state->SetString("selected_queue", | 387 state->SetString("selected_queue", |
| 388 selected_work_queue->task_queue()->GetName()); | 388 selected_work_queue->task_queue()->GetName()); |
| 389 state->SetString("work_queue_name", selected_work_queue->name()); | 389 state->SetString("work_queue_name", selected_work_queue->name()); |
| 390 } | 390 } |
| 391 | 391 |
| 392 state->BeginArray("time_domains"); | 392 state->BeginArray("time_domains"); |
| 393 for (auto& time_domain : time_domains_) | 393 for (auto* time_domain : time_domains_) |
| 394 time_domain->AsValueInto(state.get()); | 394 time_domain->AsValueInto(state.get()); |
| 395 state->EndArray(); | 395 state->EndArray(); |
| 396 return std::move(state); | 396 return std::move(state); |
| 397 } | 397 } |
| 398 | 398 |
| 399 void TaskQueueManager::OnTaskQueueEnabled(internal::TaskQueueImpl* queue) { | 399 void TaskQueueManager::OnTaskQueueEnabled(internal::TaskQueueImpl* queue) { |
| 400 DCHECK(main_thread_checker_.CalledOnValidThread()); | 400 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 401 // Only schedule DoWork if there's something to do. | 401 // Only schedule DoWork if there's something to do. |
| 402 if (!queue->immediate_work_queue()->Empty() || | 402 if (!queue->immediate_work_queue()->Empty() || |
| 403 !queue->delayed_work_queue()->Empty()) { | 403 !queue->delayed_work_queue()->Empty()) { |
| 404 MaybeScheduleImmediateWork(FROM_HERE); | 404 MaybeScheduleImmediateWork(FROM_HERE); |
| 405 } | 405 } |
| 406 } | 406 } |
| 407 | 407 |
| 408 void TaskQueueManager::OnTriedToSelectBlockedWorkQueue( | 408 void TaskQueueManager::OnTriedToSelectBlockedWorkQueue( |
| 409 internal::WorkQueue* work_queue) { | 409 internal::WorkQueue* work_queue) { |
| 410 DCHECK(main_thread_checker_.CalledOnValidThread()); | 410 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 411 DCHECK(!work_queue->Empty()); | 411 DCHECK(!work_queue->Empty()); |
| 412 if (observer_) { | 412 if (observer_) { |
| 413 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), | 413 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), |
| 414 *work_queue->GetFrontTask()); | 414 *work_queue->GetFrontTask()); |
| 415 } | 415 } |
| 416 } | 416 } |
| 417 | 417 |
| 418 } // namespace scheduler | 418 } // namespace scheduler |
| OLD | NEW |