| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/renderer/scheduler/renderer_scheduler.h" | |
| 6 | |
| 7 #include "base/command_line.h" | |
| 8 #include "base/message_loop/message_loop.h" | |
| 9 #include "base/trace_event/trace_event.h" | |
| 10 #include "base/trace_event/trace_event_impl.h" | |
| 11 #include "content/child/scheduler/scheduler_message_loop_delegate.h" | |
| 12 #include "content/public/common/content_switches.h" | |
| 13 #include "content/renderer/scheduler/null_renderer_scheduler.h" | |
| 14 #include "content/renderer/scheduler/renderer_scheduler_impl.h" | |
| 15 | |
| 16 namespace content { | |
| 17 | |
| 18 RendererScheduler::RendererScheduler() { | |
| 19 } | |
| 20 | |
| 21 RendererScheduler::~RendererScheduler() { | |
| 22 } | |
| 23 | |
| 24 // static | |
| 25 scoped_ptr<RendererScheduler> RendererScheduler::Create() { | |
| 26 // Ensure worker.scheduler appears as an option in about://tracing | |
| 27 base::trace_event::TraceLog::GetCategoryGroupEnabled( | |
| 28 TRACE_DISABLED_BY_DEFAULT("worker.scheduler")); | |
| 29 | |
| 30 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 31 if (command_line->HasSwitch(switches::kDisableBlinkScheduler)) { | |
| 32 return make_scoped_ptr(new NullRendererScheduler()); | |
| 33 } else { | |
| 34 base::MessageLoop* message_loop = base::MessageLoop::current(); | |
| 35 return make_scoped_ptr(new RendererSchedulerImpl( | |
| 36 SchedulerMessageLoopDelegate::Create(message_loop))); | |
| 37 } | |
| 38 } | |
| 39 | |
| 40 } // namespace content | |
| OLD | NEW |