1 // Copyright 2013 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 "cc/scheduler/scheduler_settings.h"
7 #include "base/debug/trace_event_argument.h"
8 #include "cc/trees/layer_tree_settings.h"
12 SchedulerSettings::SchedulerSettings()
13 : use_external_begin_frame_source(false),
14 forward_begin_frames_to_children(false),
15 main_frame_before_activation_enabled(false),
16 impl_side_painting(false),
17 timeout_and_draw_when_animation_checkerboards(true),
18 maximum_number_of_failed_draws_before_draw_is_forced_(3),
19 using_synchronous_renderer_compositor(false),
20 throttle_frame_production(true),
21 disable_hi_res_timer_tasks_on_battery(false),
22 main_thread_should_always_be_low_latency(false),
23 background_frame_interval(base::TimeDelta::FromSeconds(1)) {
26 SchedulerSettings::SchedulerSettings(const LayerTreeSettings
& settings
)
27 : use_external_begin_frame_source(settings
.use_external_begin_frame_source
),
28 forward_begin_frames_to_children(
29 settings
.forward_begin_frames_to_children
),
30 main_frame_before_activation_enabled(
31 settings
.main_frame_before_activation_enabled
),
32 impl_side_painting(settings
.impl_side_painting
),
33 timeout_and_draw_when_animation_checkerboards(
34 settings
.timeout_and_draw_when_animation_checkerboards
),
35 maximum_number_of_failed_draws_before_draw_is_forced_(
36 settings
.maximum_number_of_failed_draws_before_draw_is_forced_
),
37 using_synchronous_renderer_compositor(
38 settings
.using_synchronous_renderer_compositor
),
39 throttle_frame_production(settings
.throttle_frame_production
),
40 disable_hi_res_timer_tasks_on_battery(
41 settings
.disable_hi_res_timer_tasks_on_battery
),
42 main_thread_should_always_be_low_latency(false),
43 background_frame_interval(base::TimeDelta::FromSecondsD(
44 1.0 / settings
.background_animation_rate
)) {
47 SchedulerSettings::~SchedulerSettings() {}
49 scoped_refptr
<base::debug::ConvertableToTraceFormat
>
50 SchedulerSettings::AsValue() const {
51 scoped_refptr
<base::debug::TracedValue
> state
=
52 new base::debug::TracedValue();
53 state
->SetBoolean("use_external_begin_frame_source",
54 use_external_begin_frame_source
);
55 state
->SetBoolean("forward_begin_frames_to_children",
56 forward_begin_frames_to_children
);
57 state
->SetBoolean("main_frame_before_activation_enabled",
58 main_frame_before_activation_enabled
);
59 state
->SetBoolean("impl_side_painting", impl_side_painting
);
60 state
->SetBoolean("timeout_and_draw_when_animation_checkerboards",
61 timeout_and_draw_when_animation_checkerboards
);
62 state
->SetInteger("maximum_number_of_failed_draws_before_draw_is_forced_",
63 maximum_number_of_failed_draws_before_draw_is_forced_
);
64 state
->SetBoolean("using_synchronous_renderer_compositor",
65 using_synchronous_renderer_compositor
);
66 state
->SetBoolean("throttle_frame_production", throttle_frame_production
);
67 state
->SetBoolean("disable_hi_res_timer_tasks_on_battery",
68 disable_hi_res_timer_tasks_on_battery
);
69 state
->SetBoolean("main_thread_should_always_be_low_latency",
70 main_thread_should_always_be_low_latency
);
71 state
->SetInteger("background_frame_interval",
72 background_frame_interval
.InMicroseconds());