Lots of random cleanups, mostly for native_theme_win.cc:
[chromium-blink-merge.git] / cc / scheduler / scheduler_settings.cc
blobf1bf60e7865670e4351dc061833af9d74b1f0ef7
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 "cc/trees/layer_tree_settings.h"
9 namespace cc {
11 SchedulerSettings::SchedulerSettings()
12 : begin_frame_scheduling_enabled(true),
13 main_frame_before_draw_enabled(true),
14 main_frame_before_activation_enabled(false),
15 impl_side_painting(false),
16 timeout_and_draw_when_animation_checkerboards(true),
17 maximum_number_of_failed_draws_before_draw_is_forced_(3),
18 using_synchronous_renderer_compositor(false),
19 throttle_frame_production(true) {
22 SchedulerSettings::SchedulerSettings(const LayerTreeSettings& settings)
23 : begin_frame_scheduling_enabled(settings.begin_frame_scheduling_enabled),
24 main_frame_before_draw_enabled(settings.main_frame_before_draw_enabled),
25 main_frame_before_activation_enabled(
26 settings.main_frame_before_activation_enabled),
27 impl_side_painting(settings.impl_side_painting),
28 timeout_and_draw_when_animation_checkerboards(
29 settings.timeout_and_draw_when_animation_checkerboards),
30 maximum_number_of_failed_draws_before_draw_is_forced_(
31 settings.maximum_number_of_failed_draws_before_draw_is_forced_),
32 using_synchronous_renderer_compositor(
33 settings.using_synchronous_renderer_compositor),
34 throttle_frame_production(settings.throttle_frame_production) {
37 SchedulerSettings::~SchedulerSettings() {}
39 scoped_ptr<base::Value> SchedulerSettings::AsValue() const {
40 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue);
41 state->SetBoolean("begin_frame_scheduling_enabled",
42 begin_frame_scheduling_enabled);
43 state->SetBoolean("main_frame_before_draw_enabled",
44 main_frame_before_draw_enabled);
45 state->SetBoolean("main_frame_before_activation_enabled",
46 main_frame_before_activation_enabled);
47 state->SetBoolean("impl_side_painting", impl_side_painting);
48 state->SetBoolean("timeout_and_draw_when_animation_checkerboards",
49 timeout_and_draw_when_animation_checkerboards);
50 state->SetInteger("maximum_number_of_failed_draws_before_draw_is_forced_",
51 maximum_number_of_failed_draws_before_draw_is_forced_);
52 state->SetBoolean("using_synchronous_renderer_compositor",
53 using_synchronous_renderer_compositor);
54 state->SetBoolean("throttle_frame_production", throttle_frame_production);
55 return state.PassAs<base::Value>();
58 } // namespace cc