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.
5 #include "components/scheduler/renderer/renderer_scheduler.h"
7 #include "base/message_loop/message_loop.h"
8 #include "base/trace_event/trace_event.h"
9 #include "base/trace_event/trace_event_impl.h"
10 #include "components/scheduler/child/scheduler_task_runner_delegate_impl.h"
11 #include "components/scheduler/renderer/renderer_scheduler_impl.h"
15 RendererScheduler::RendererScheduler() {
18 RendererScheduler::~RendererScheduler() {
22 scoped_ptr
<RendererScheduler
> RendererScheduler::Create() {
23 // Ensure worker.scheduler, worker.scheduler.debug and
24 // renderer.scheduler.debug appear as an option in about://tracing
25 base::trace_event::TraceLog::GetCategoryGroupEnabled(
26 TRACE_DISABLED_BY_DEFAULT("worker.scheduler"));
27 base::trace_event::TraceLog::GetCategoryGroupEnabled(
28 TRACE_DISABLED_BY_DEFAULT("worker.scheduler.debug"));
29 base::trace_event::TraceLog::GetCategoryGroupEnabled(
30 TRACE_DISABLED_BY_DEFAULT("renderer.scheduler.debug"));
32 base::MessageLoop
* message_loop
= base::MessageLoop::current();
33 return make_scoped_ptr(new RendererSchedulerImpl(
34 SchedulerTaskRunnerDelegateImpl::Create(message_loop
)));
38 const char* RendererScheduler::UseCaseToString(UseCase use_case
) {
42 case UseCase::COMPOSITOR_GESTURE
:
43 return "compositor_gesture";
44 case UseCase::MAIN_THREAD_GESTURE
:
45 return "main_thread_gesture";
46 case UseCase::TOUCHSTART
:
48 case UseCase::LOADING
:
57 const char* RendererScheduler::InputEventStateToString(
58 InputEventState input_event_state
) {
59 switch (input_event_state
) {
60 case InputEventState::EVENT_CONSUMED_BY_COMPOSITOR
:
61 return "event_consumed_by_compositor";
62 case InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD
:
63 return "event_forwarded_to_main_thread";
70 } // namespace scheduler