| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 state->BeginDictionary("selector"); | 407 state->BeginDictionary("selector"); |
| 408 selector_.AsValueInto(state.get()); | 408 selector_.AsValueInto(state.get()); |
| 409 state->EndDictionary(); | 409 state->EndDictionary(); |
| 410 if (should_run) { | 410 if (should_run) { |
| 411 state->SetString("selected_queue", | 411 state->SetString("selected_queue", |
| 412 selected_work_queue->task_queue()->GetName()); | 412 selected_work_queue->task_queue()->GetName()); |
| 413 state->SetString("work_queue_name", selected_work_queue->name()); | 413 state->SetString("work_queue_name", selected_work_queue->name()); |
| 414 } | 414 } |
| 415 | 415 |
| 416 state->BeginArray("time_domains"); | 416 state->BeginArray("time_domains"); |
| 417 for (auto& time_domain : time_domains_) | 417 for (auto* time_domain : time_domains_) |
| 418 time_domain->AsValueInto(state.get()); | 418 time_domain->AsValueInto(state.get()); |
| 419 state->EndArray(); | 419 state->EndArray(); |
| 420 return std::move(state); | 420 return std::move(state); |
| 421 } | 421 } |
| 422 | 422 |
| 423 void TaskQueueManager::OnTaskQueueEnabled(internal::TaskQueueImpl* queue) { | 423 void TaskQueueManager::OnTaskQueueEnabled(internal::TaskQueueImpl* queue) { |
| 424 DCHECK(main_thread_checker_.CalledOnValidThread()); | 424 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 425 // Only schedule DoWork if there's something to do. | 425 // Only schedule DoWork if there's something to do. |
| 426 if (!queue->immediate_work_queue()->Empty() || | 426 if (!queue->immediate_work_queue()->Empty() || |
| 427 !queue->delayed_work_queue()->Empty()) { | 427 !queue->delayed_work_queue()->Empty()) { |
| 428 MaybeScheduleImmediateWork(FROM_HERE); | 428 MaybeScheduleImmediateWork(FROM_HERE); |
| 429 } | 429 } |
| 430 } | 430 } |
| 431 | 431 |
| 432 void TaskQueueManager::OnTriedToSelectBlockedWorkQueue( | 432 void TaskQueueManager::OnTriedToSelectBlockedWorkQueue( |
| 433 internal::WorkQueue* work_queue) { | 433 internal::WorkQueue* work_queue) { |
| 434 DCHECK(main_thread_checker_.CalledOnValidThread()); | 434 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 435 DCHECK(!work_queue->Empty()); | 435 DCHECK(!work_queue->Empty()); |
| 436 if (observer_) { | 436 if (observer_) { |
| 437 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), | 437 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), |
| 438 *work_queue->GetFrontTask()); | 438 *work_queue->GetFrontTask()); |
| 439 } | 439 } |
| 440 } | 440 } |
| 441 | 441 |
| 442 } // namespace scheduler | 442 } // namespace scheduler |
| OLD | NEW |