| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/scheduler_helper.h" | 5 #include "content/child/scheduler/scheduler_helper.h" |
| 6 | 6 |
| 7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
| 8 #include "base/trace_event/trace_event_argument.h" | 8 #include "base/trace_event/trace_event_argument.h" |
| 9 #include "content/child/scheduler/nestable_single_thread_task_runner.h" | 9 #include "content/child/scheduler/nestable_single_thread_task_runner.h" |
| 10 #include "content/child/scheduler/prioritizing_task_queue_selector.h" | 10 #include "content/child/scheduler/prioritizing_task_queue_selector.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 SchedulerHelper::IdlePeriodState | 330 SchedulerHelper::IdlePeriodState |
| 331 SchedulerHelper::SchedulerIdlePeriodState() const { | 331 SchedulerHelper::SchedulerIdlePeriodState() const { |
| 332 return idle_period_state_; | 332 return idle_period_state_; |
| 333 } | 333 } |
| 334 | 334 |
| 335 PrioritizingTaskQueueSelector* | 335 PrioritizingTaskQueueSelector* |
| 336 SchedulerHelper::SchedulerTaskQueueSelector() const { | 336 SchedulerHelper::SchedulerTaskQueueSelector() const { |
| 337 return task_queue_selector_.get(); | 337 return task_queue_selector_.get(); |
| 338 } | 338 } |
| 339 | 339 |
| 340 TaskQueueManager* SchedulerHelper::SchedulerTaskQueueManager() const { | 340 scoped_refptr<base::SingleThreadTaskRunner> SchedulerHelper::TaskRunnerForQueue( |
| 341 return task_queue_manager_.get(); | 341 size_t queue_index) const { |
| 342 CheckOnValidThread(); |
| 343 return task_queue_manager_->TaskRunnerForQueue(queue_index); |
| 344 } |
| 345 |
| 346 void SchedulerHelper::SetQueueName(size_t queue_index, const char* name) { |
| 347 CheckOnValidThread(); |
| 348 task_queue_manager_->SetQueueName(queue_index, name); |
| 349 } |
| 350 |
| 351 bool SchedulerHelper::IsQueueEmpty(size_t queue_index) const { |
| 352 CheckOnValidThread(); |
| 353 return task_queue_manager_->IsQueueEmpty(queue_index); |
| 342 } | 354 } |
| 343 | 355 |
| 344 // static | 356 // static |
| 345 const char* SchedulerHelper::TaskQueueIdToString(QueueId queue_id) { | 357 const char* SchedulerHelper::TaskQueueIdToString(QueueId queue_id) { |
| 346 switch (queue_id) { | 358 switch (queue_id) { |
| 347 case DEFAULT_TASK_QUEUE: | 359 case DEFAULT_TASK_QUEUE: |
| 348 return "default_tq"; | 360 return "default_tq"; |
| 349 case IDLE_TASK_QUEUE: | 361 case IDLE_TASK_QUEUE: |
| 350 return "idle_tq"; | 362 return "idle_tq"; |
| 351 case CONTROL_TASK_QUEUE: | 363 case CONTROL_TASK_QUEUE: |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 } | 398 } |
| 387 | 399 |
| 388 void SchedulerHelper::RemoveTaskObserver( | 400 void SchedulerHelper::RemoveTaskObserver( |
| 389 base::MessageLoop::TaskObserver* task_observer) { | 401 base::MessageLoop::TaskObserver* task_observer) { |
| 390 CheckOnValidThread(); | 402 CheckOnValidThread(); |
| 391 if (task_queue_manager_) | 403 if (task_queue_manager_) |
| 392 task_queue_manager_->RemoveTaskObserver(task_observer); | 404 task_queue_manager_->RemoveTaskObserver(task_observer); |
| 393 } | 405 } |
| 394 | 406 |
| 395 } // namespace content | 407 } // namespace content |
| OLD | NEW |