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 background_frame_interval(base::TimeDelta::FromSeconds(1)) {
25 SchedulerSettings::SchedulerSettings(const LayerTreeSettings
& settings
)
26 : use_external_begin_frame_source(settings
.use_external_begin_frame_source
),
27 forward_begin_frames_to_children(
28 settings
.forward_begin_frames_to_children
),
29 main_frame_before_activation_enabled(
30 settings
.main_frame_before_activation_enabled
),
31 impl_side_painting(settings
.impl_side_painting
),
32 timeout_and_draw_when_animation_checkerboards(
33 settings
.timeout_and_draw_when_animation_checkerboards
),
34 maximum_number_of_failed_draws_before_draw_is_forced_(
35 settings
.maximum_number_of_failed_draws_before_draw_is_forced_
),
36 using_synchronous_renderer_compositor(
37 settings
.using_synchronous_renderer_compositor
),
38 throttle_frame_production(settings
.throttle_frame_production
),
39 disable_hi_res_timer_tasks_on_battery(
40 settings
.disable_hi_res_timer_tasks_on_battery
),
41 background_frame_interval(base::TimeDelta::FromSecondsD(
42 1.0 / settings
.background_animation_rate
)) {
45 SchedulerSettings::~SchedulerSettings() {}
47 scoped_refptr
<base::debug::ConvertableToTraceFormat
>
48 SchedulerSettings::AsValue() const {
49 scoped_refptr
<base::debug::TracedValue
> state
=
50 new base::debug::TracedValue();
51 state
->SetBoolean("use_external_begin_frame_source",
52 use_external_begin_frame_source
);
53 state
->SetBoolean("forward_begin_frames_to_children",
54 forward_begin_frames_to_children
);
55 state
->SetBoolean("main_frame_before_activation_enabled",
56 main_frame_before_activation_enabled
);
57 state
->SetBoolean("impl_side_painting", impl_side_painting
);
58 state
->SetBoolean("timeout_and_draw_when_animation_checkerboards",
59 timeout_and_draw_when_animation_checkerboards
);
60 state
->SetInteger("maximum_number_of_failed_draws_before_draw_is_forced_",
61 maximum_number_of_failed_draws_before_draw_is_forced_
);
62 state
->SetBoolean("using_synchronous_renderer_compositor",
63 using_synchronous_renderer_compositor
);
64 state
->SetBoolean("throttle_frame_production", throttle_frame_production
);
65 state
->SetBoolean("disable_hi_res_timer_tasks_on_battery",
66 disable_hi_res_timer_tasks_on_battery
);
67 state
->SetInteger("background_frame_interval",
68 background_frame_interval
.InMicroseconds());