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
3 // found in the LICENSE file.
5 #include "components/scheduler/child/worker_scheduler.h"
7 #include "base/command_line.h"
8 #include "base/message_loop/message_loop.h"
9 #include "components/scheduler/child/null_worker_scheduler.h"
10 #include "components/scheduler/child/scheduler_task_runner_delegate.h"
11 #include "components/scheduler/child/worker_scheduler_impl.h"
12 #include "components/scheduler/common/scheduler_switches.h"
16 WorkerScheduler::WorkerScheduler() {
19 WorkerScheduler::~WorkerScheduler() {
23 scoped_ptr
<WorkerScheduler
> WorkerScheduler::Create(
24 scoped_refptr
<SchedulerTaskRunnerDelegate
> main_task_runner
) {
25 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
26 if (command_line
->HasSwitch(switches::kDisableBlinkScheduler
)) {
27 return make_scoped_ptr(new NullWorkerScheduler());
29 return make_scoped_ptr(new WorkerSchedulerImpl(main_task_runner
.Pass()));
33 } // namespace scheduler