OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/scheduler/scheduler_settings.h" | 5 #include "cc/scheduler/scheduler_settings.h" |
6 | 6 |
7 #include "base/trace_event/trace_event_argument.h" | 7 #include "base/trace_event/trace_event_argument.h" |
8 #include "cc/trees/layer_tree_settings.h" | 8 #include "cc/trees/layer_tree_settings.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
11 | 11 |
12 SchedulerSettings::SchedulerSettings() | 12 SchedulerSettings::SchedulerSettings() |
13 : use_external_begin_frame_source(false), | 13 : use_external_begin_frame_source(false), |
14 forward_begin_frames_to_children(false), | |
15 main_frame_before_activation_enabled(false), | 14 main_frame_before_activation_enabled(false), |
16 impl_side_painting(false), | 15 impl_side_painting(false), |
17 timeout_and_draw_when_animation_checkerboards(true), | 16 timeout_and_draw_when_animation_checkerboards(true), |
18 maximum_number_of_failed_draws_before_draw_is_forced_(3), | 17 maximum_number_of_failed_draws_before_draw_is_forced_(3), |
19 using_synchronous_renderer_compositor(false), | 18 using_synchronous_renderer_compositor(false), |
20 throttle_frame_production(true), | 19 throttle_frame_production(true), |
21 disable_hi_res_timer_tasks_on_battery(false), | 20 disable_hi_res_timer_tasks_on_battery(false), |
22 main_thread_should_always_be_low_latency(false), | 21 main_thread_should_always_be_low_latency(false), |
23 background_frame_interval(base::TimeDelta::FromSeconds(1)) { | 22 background_frame_interval(base::TimeDelta::FromSeconds(1)) { |
24 } | 23 } |
25 | 24 |
26 SchedulerSettings::SchedulerSettings(const LayerTreeSettings& settings) | 25 SchedulerSettings::SchedulerSettings(const LayerTreeSettings& settings) |
27 : use_external_begin_frame_source(settings.use_external_begin_frame_source), | 26 : 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( | 27 main_frame_before_activation_enabled( |
31 settings.main_frame_before_activation_enabled), | 28 settings.main_frame_before_activation_enabled), |
32 impl_side_painting(settings.impl_side_painting), | 29 impl_side_painting(settings.impl_side_painting), |
33 timeout_and_draw_when_animation_checkerboards( | 30 timeout_and_draw_when_animation_checkerboards( |
34 settings.timeout_and_draw_when_animation_checkerboards), | 31 settings.timeout_and_draw_when_animation_checkerboards), |
35 maximum_number_of_failed_draws_before_draw_is_forced_( | 32 maximum_number_of_failed_draws_before_draw_is_forced_( |
36 settings.maximum_number_of_failed_draws_before_draw_is_forced_), | 33 settings.maximum_number_of_failed_draws_before_draw_is_forced_), |
37 using_synchronous_renderer_compositor( | 34 using_synchronous_renderer_compositor( |
38 settings.using_synchronous_renderer_compositor), | 35 settings.using_synchronous_renderer_compositor), |
39 throttle_frame_production(settings.throttle_frame_production), | 36 throttle_frame_production(settings.throttle_frame_production), |
40 disable_hi_res_timer_tasks_on_battery( | 37 disable_hi_res_timer_tasks_on_battery( |
41 settings.disable_hi_res_timer_tasks_on_battery), | 38 settings.disable_hi_res_timer_tasks_on_battery), |
42 main_thread_should_always_be_low_latency(false), | 39 main_thread_should_always_be_low_latency(false), |
43 background_frame_interval(base::TimeDelta::FromSecondsD( | 40 background_frame_interval(base::TimeDelta::FromSecondsD( |
44 1.0 / settings.background_animation_rate)) { | 41 1.0 / settings.background_animation_rate)) { |
45 } | 42 } |
46 | 43 |
47 SchedulerSettings::~SchedulerSettings() {} | 44 SchedulerSettings::~SchedulerSettings() {} |
48 | 45 |
49 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 46 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
50 SchedulerSettings::AsValue() const { | 47 SchedulerSettings::AsValue() const { |
51 scoped_refptr<base::trace_event::TracedValue> state = | 48 scoped_refptr<base::trace_event::TracedValue> state = |
52 new base::trace_event::TracedValue(); | 49 new base::trace_event::TracedValue(); |
53 state->SetBoolean("use_external_begin_frame_source", | 50 state->SetBoolean("use_external_begin_frame_source", |
54 use_external_begin_frame_source); | 51 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", | 52 state->SetBoolean("main_frame_before_activation_enabled", |
58 main_frame_before_activation_enabled); | 53 main_frame_before_activation_enabled); |
59 state->SetBoolean("impl_side_painting", impl_side_painting); | 54 state->SetBoolean("impl_side_painting", impl_side_painting); |
60 state->SetBoolean("timeout_and_draw_when_animation_checkerboards", | 55 state->SetBoolean("timeout_and_draw_when_animation_checkerboards", |
61 timeout_and_draw_when_animation_checkerboards); | 56 timeout_and_draw_when_animation_checkerboards); |
62 state->SetInteger("maximum_number_of_failed_draws_before_draw_is_forced_", | 57 state->SetInteger("maximum_number_of_failed_draws_before_draw_is_forced_", |
63 maximum_number_of_failed_draws_before_draw_is_forced_); | 58 maximum_number_of_failed_draws_before_draw_is_forced_); |
64 state->SetBoolean("using_synchronous_renderer_compositor", | 59 state->SetBoolean("using_synchronous_renderer_compositor", |
65 using_synchronous_renderer_compositor); | 60 using_synchronous_renderer_compositor); |
66 state->SetBoolean("throttle_frame_production", throttle_frame_production); | 61 state->SetBoolean("throttle_frame_production", throttle_frame_production); |
67 state->SetBoolean("disable_hi_res_timer_tasks_on_battery", | 62 state->SetBoolean("disable_hi_res_timer_tasks_on_battery", |
68 disable_hi_res_timer_tasks_on_battery); | 63 disable_hi_res_timer_tasks_on_battery); |
69 state->SetBoolean("main_thread_should_always_be_low_latency", | 64 state->SetBoolean("main_thread_should_always_be_low_latency", |
70 main_thread_should_always_be_low_latency); | 65 main_thread_should_always_be_low_latency); |
71 state->SetInteger("background_frame_interval", | 66 state->SetInteger("background_frame_interval", |
72 background_frame_interval.InMicroseconds()); | 67 background_frame_interval.InMicroseconds()); |
73 return state; | 68 return state; |
74 } | 69 } |
75 | 70 |
76 } // namespace cc | 71 } // namespace cc |
OLD | NEW |