Roll src/third_party/WebKit 7eb2976:33ba8ad (svn 202511:202514)
[chromium-blink-merge.git] / cc / debug / layer_tree_debug_state.cc
bloba084bf38d201a7aa7b8b74dc86864da71e08b820
1 // Copyright 2011 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/debug/layer_tree_debug_state.h"
7 #include "base/logging.h"
9 namespace cc {
11 // IMPORTANT: new fields must be added to Equal() and Unite()
12 LayerTreeDebugState::LayerTreeDebugState()
13 : show_fps_counter(false),
14 show_debug_borders(false),
15 show_paint_rects(false),
16 show_property_changed_rects(false),
17 show_surface_damage_rects(false),
18 show_screen_space_rects(false),
19 show_replica_screen_space_rects(false),
20 show_touch_event_handler_rects(false),
21 show_wheel_event_handler_rects(false),
22 show_scroll_event_handler_rects(false),
23 show_non_fast_scrollable_rects(false),
24 show_layer_animation_bounds_rects(false),
25 slow_down_raster_scale_factor(0),
26 rasterize_only_visible_content(false),
27 show_picture_borders(false),
28 record_rendering_stats_(false) {}
30 LayerTreeDebugState::~LayerTreeDebugState() {}
32 void LayerTreeDebugState::SetRecordRenderingStats(bool enabled) {
33 record_rendering_stats_ = enabled;
36 bool LayerTreeDebugState::RecordRenderingStats() const {
37 return record_rendering_stats_;
40 bool LayerTreeDebugState::ShowHudInfo() const {
41 return show_fps_counter || ShowHudRects();
44 bool LayerTreeDebugState::ShowHudRects() const {
45 return show_paint_rects || show_property_changed_rects ||
46 show_surface_damage_rects || show_screen_space_rects ||
47 show_replica_screen_space_rects || show_touch_event_handler_rects ||
48 show_wheel_event_handler_rects || show_scroll_event_handler_rects ||
49 show_non_fast_scrollable_rects || show_layer_animation_bounds_rects;
52 bool LayerTreeDebugState::ShowMemoryStats() const {
53 return show_fps_counter;
56 bool LayerTreeDebugState::Equal(const LayerTreeDebugState& a,
57 const LayerTreeDebugState& b) {
58 return (
59 a.show_fps_counter == b.show_fps_counter &&
60 a.show_debug_borders == b.show_debug_borders &&
61 a.show_paint_rects == b.show_paint_rects &&
62 a.show_property_changed_rects == b.show_property_changed_rects &&
63 a.show_surface_damage_rects == b.show_surface_damage_rects &&
64 a.show_screen_space_rects == b.show_screen_space_rects &&
65 a.show_replica_screen_space_rects == b.show_replica_screen_space_rects &&
66 a.show_touch_event_handler_rects == b.show_touch_event_handler_rects &&
67 a.show_wheel_event_handler_rects == b.show_wheel_event_handler_rects &&
68 a.show_scroll_event_handler_rects == b.show_scroll_event_handler_rects &&
69 a.show_non_fast_scrollable_rects == b.show_non_fast_scrollable_rects &&
70 a.show_layer_animation_bounds_rects ==
71 b.show_layer_animation_bounds_rects &&
72 a.slow_down_raster_scale_factor == b.slow_down_raster_scale_factor &&
73 a.rasterize_only_visible_content == b.rasterize_only_visible_content &&
74 a.show_picture_borders == b.show_picture_borders &&
75 a.record_rendering_stats_ == b.record_rendering_stats_);
78 LayerTreeDebugState LayerTreeDebugState::Unite(const LayerTreeDebugState& a,
79 const LayerTreeDebugState& b) {
80 LayerTreeDebugState r(a);
82 r.show_fps_counter |= b.show_fps_counter;
83 r.show_debug_borders |= b.show_debug_borders;
85 r.show_paint_rects |= b.show_paint_rects;
86 r.show_property_changed_rects |= b.show_property_changed_rects;
87 r.show_surface_damage_rects |= b.show_surface_damage_rects;
88 r.show_screen_space_rects |= b.show_screen_space_rects;
89 r.show_replica_screen_space_rects |= b.show_replica_screen_space_rects;
90 r.show_touch_event_handler_rects |= b.show_touch_event_handler_rects;
91 r.show_wheel_event_handler_rects |= b.show_wheel_event_handler_rects;
92 r.show_scroll_event_handler_rects |= b.show_scroll_event_handler_rects;
93 r.show_non_fast_scrollable_rects |= b.show_non_fast_scrollable_rects;
94 r.show_layer_animation_bounds_rects |= b.show_layer_animation_bounds_rects;
96 if (b.slow_down_raster_scale_factor)
97 r.slow_down_raster_scale_factor = b.slow_down_raster_scale_factor;
98 r.rasterize_only_visible_content |= b.rasterize_only_visible_content;
99 r.show_picture_borders |= b.show_picture_borders;
101 r.record_rendering_stats_ |= b.record_rendering_stats_;
103 return r;
106 } // namespace cc