Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(908)

Side by Side Diff: cc/debug/debug_rect_history.cc

Issue 1846043002: cc : Make CallFunctionForSubtree on impl use layer iterator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/debug/debug_rect_history.h ('k') | cc/debug/invalidation_benchmark.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/debug/debug_rect_history.h" 5 #include "cc/debug/debug_rect_history.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/layers/layer_impl.h" 10 #include "cc/layers/layer_impl.h"
(...skipping 21 matching lines...) Expand all
32 void DebugRectHistory::SaveDebugRectsForCurrentFrame( 32 void DebugRectHistory::SaveDebugRectsForCurrentFrame(
33 LayerImpl* root_layer, 33 LayerImpl* root_layer,
34 LayerImpl* hud_layer, 34 LayerImpl* hud_layer,
35 const LayerImplList& render_surface_layer_list, 35 const LayerImplList& render_surface_layer_list,
36 const LayerTreeDebugState& debug_state) { 36 const LayerTreeDebugState& debug_state) {
37 // For now, clear all rects from previous frames. In the future we may want to 37 // For now, clear all rects from previous frames. In the future we may want to
38 // store all debug rects for a history of many frames. 38 // store all debug rects for a history of many frames.
39 debug_rects_.clear(); 39 debug_rects_.clear();
40 40
41 if (debug_state.show_touch_event_handler_rects) 41 if (debug_state.show_touch_event_handler_rects)
42 SaveTouchEventHandlerRects(root_layer); 42 SaveTouchEventHandlerRects(root_layer->layer_tree_impl());
43 43
44 if (debug_state.show_wheel_event_handler_rects) 44 if (debug_state.show_wheel_event_handler_rects)
45 SaveWheelEventHandlerRects(root_layer); 45 SaveWheelEventHandlerRects(root_layer);
46 46
47 if (debug_state.show_scroll_event_handler_rects) 47 if (debug_state.show_scroll_event_handler_rects)
48 SaveScrollEventHandlerRects(root_layer); 48 SaveScrollEventHandlerRects(root_layer->layer_tree_impl());
49 49
50 if (debug_state.show_non_fast_scrollable_rects) 50 if (debug_state.show_non_fast_scrollable_rects)
51 SaveNonFastScrollableRects(root_layer); 51 SaveNonFastScrollableRects(root_layer->layer_tree_impl());
52 52
53 if (debug_state.show_paint_rects) 53 if (debug_state.show_paint_rects)
54 SavePaintRects(root_layer); 54 SavePaintRects(root_layer);
55 55
56 if (debug_state.show_property_changed_rects) 56 if (debug_state.show_property_changed_rects)
57 SavePropertyChangedRects(render_surface_layer_list, hud_layer); 57 SavePropertyChangedRects(render_surface_layer_list, hud_layer);
58 58
59 if (debug_state.show_surface_damage_rects) 59 if (debug_state.show_surface_damage_rects)
60 SaveSurfaceDamageRects(render_surface_layer_list); 60 SaveSurfaceDamageRects(render_surface_layer_list);
61 61
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 if (render_surface_layer->replica_layer()) { 150 if (render_surface_layer->replica_layer()) {
151 debug_rects_.push_back( 151 debug_rects_.push_back(
152 DebugRect(REPLICA_SCREEN_SPACE_RECT_TYPE, 152 DebugRect(REPLICA_SCREEN_SPACE_RECT_TYPE,
153 MathUtil::MapEnclosingClippedRect( 153 MathUtil::MapEnclosingClippedRect(
154 render_surface->replica_screen_space_transform(), 154 render_surface->replica_screen_space_transform(),
155 render_surface->content_rect()))); 155 render_surface->content_rect())));
156 } 156 }
157 } 157 }
158 } 158 }
159 159
160 void DebugRectHistory::SaveTouchEventHandlerRects(LayerImpl* layer) { 160 void DebugRectHistory::SaveTouchEventHandlerRects(LayerTreeImpl* tree_impl) {
161 LayerTreeHostCommon::CallFunctionForSubtree(layer, [this](LayerImpl* layer) { 161 LayerTreeHostCommon::CallFunctionForEveryLayer(
162 SaveTouchEventHandlerRectsCallback(layer); 162 tree_impl,
163 }); 163 [this](LayerImpl* layer) { SaveTouchEventHandlerRectsCallback(layer); });
164 } 164 }
165 165
166 void DebugRectHistory::SaveTouchEventHandlerRectsCallback(LayerImpl* layer) { 166 void DebugRectHistory::SaveTouchEventHandlerRectsCallback(LayerImpl* layer) {
167 for (Region::Iterator iter(layer->touch_event_handler_region()); 167 for (Region::Iterator iter(layer->touch_event_handler_region());
168 iter.has_rect(); 168 iter.has_rect();
169 iter.next()) { 169 iter.next()) {
170 debug_rects_.push_back( 170 debug_rects_.push_back(
171 DebugRect(TOUCH_EVENT_HANDLER_RECT_TYPE, 171 DebugRect(TOUCH_EVENT_HANDLER_RECT_TYPE,
172 MathUtil::MapEnclosingClippedRect( 172 MathUtil::MapEnclosingClippedRect(
173 layer->ScreenSpaceTransform(), iter.rect()))); 173 layer->ScreenSpaceTransform(), iter.rect())));
(...skipping 15 matching lines...) Expand all
189 LayerImpl* inner_viewport = 189 LayerImpl* inner_viewport =
190 root_layer->layer_tree_impl()->InnerViewportScrollLayer(); 190 root_layer->layer_tree_impl()->InnerViewportScrollLayer();
191 if (!inner_viewport) 191 if (!inner_viewport)
192 return; 192 return;
193 debug_rects_.push_back(DebugRect( 193 debug_rects_.push_back(DebugRect(
194 WHEEL_EVENT_HANDLER_RECT_TYPE, 194 WHEEL_EVENT_HANDLER_RECT_TYPE,
195 MathUtil::MapEnclosingClippedRect(inner_viewport->ScreenSpaceTransform(), 195 MathUtil::MapEnclosingClippedRect(inner_viewport->ScreenSpaceTransform(),
196 gfx::Rect(inner_viewport->bounds())))); 196 gfx::Rect(inner_viewport->bounds()))));
197 } 197 }
198 198
199 void DebugRectHistory::SaveScrollEventHandlerRects(LayerImpl* layer) { 199 void DebugRectHistory::SaveScrollEventHandlerRects(LayerTreeImpl* tree_impl) {
200 LayerTreeHostCommon::CallFunctionForSubtree(layer, [this](LayerImpl* layer) { 200 LayerTreeHostCommon::CallFunctionForEveryLayer(
201 SaveScrollEventHandlerRectsCallback(layer); 201 tree_impl,
202 }); 202 [this](LayerImpl* layer) { SaveScrollEventHandlerRectsCallback(layer); });
203 } 203 }
204 204
205 void DebugRectHistory::SaveScrollEventHandlerRectsCallback(LayerImpl* layer) { 205 void DebugRectHistory::SaveScrollEventHandlerRectsCallback(LayerImpl* layer) {
206 if (!layer->layer_tree_impl()->have_scroll_event_handlers()) 206 if (!layer->layer_tree_impl()->have_scroll_event_handlers())
207 return; 207 return;
208 208
209 debug_rects_.push_back( 209 debug_rects_.push_back(
210 DebugRect(SCROLL_EVENT_HANDLER_RECT_TYPE, 210 DebugRect(SCROLL_EVENT_HANDLER_RECT_TYPE,
211 MathUtil::MapEnclosingClippedRect(layer->ScreenSpaceTransform(), 211 MathUtil::MapEnclosingClippedRect(layer->ScreenSpaceTransform(),
212 gfx::Rect(layer->bounds())))); 212 gfx::Rect(layer->bounds()))));
213 } 213 }
214 214
215 void DebugRectHistory::SaveNonFastScrollableRects(LayerImpl* layer) { 215 void DebugRectHistory::SaveNonFastScrollableRects(LayerTreeImpl* tree_impl) {
216 LayerTreeHostCommon::CallFunctionForSubtree(layer, [this](LayerImpl* layer) { 216 LayerTreeHostCommon::CallFunctionForEveryLayer(
217 SaveNonFastScrollableRectsCallback(layer); 217 tree_impl,
218 }); 218 [this](LayerImpl* layer) { SaveNonFastScrollableRectsCallback(layer); });
219 } 219 }
220 220
221 void DebugRectHistory::SaveNonFastScrollableRectsCallback(LayerImpl* layer) { 221 void DebugRectHistory::SaveNonFastScrollableRectsCallback(LayerImpl* layer) {
222 for (Region::Iterator iter(layer->non_fast_scrollable_region()); 222 for (Region::Iterator iter(layer->non_fast_scrollable_region());
223 iter.has_rect(); 223 iter.has_rect();
224 iter.next()) { 224 iter.next()) {
225 debug_rects_.push_back( 225 debug_rects_.push_back(
226 DebugRect(NON_FAST_SCROLLABLE_RECT_TYPE, 226 DebugRect(NON_FAST_SCROLLABLE_RECT_TYPE,
227 MathUtil::MapEnclosingClippedRect( 227 MathUtil::MapEnclosingClippedRect(
228 layer->ScreenSpaceTransform(), iter.rect()))); 228 layer->ScreenSpaceTransform(), iter.rect())));
(...skipping 17 matching lines...) Expand all
246 debug_rects_.push_back( 246 debug_rects_.push_back(
247 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, 247 DebugRect(ANIMATION_BOUNDS_RECT_TYPE,
248 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), 248 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(),
249 inflated_bounds.y(), 249 inflated_bounds.y(),
250 inflated_bounds.width(), 250 inflated_bounds.width(),
251 inflated_bounds.height())))); 251 inflated_bounds.height()))));
252 } 252 }
253 } 253 }
254 254
255 } // namespace cc 255 } // namespace cc
OLDNEW
« no previous file with comments | « cc/debug/debug_rect_history.h ('k') | cc/debug/invalidation_benchmark.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698