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

Unified Diff: cc/debug/debug_rect_history.cc

Issue 1754333003: Use the iterator for DebugRectHistory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/debug/debug_rect_history.cc
diff --git a/cc/debug/debug_rect_history.cc b/cc/debug/debug_rect_history.cc
index 87d83b83c44b14c60ed7e77355ab6247800cbe3d..ebe6936f6473210d00bbda025602ce9eecca677c 100644
--- a/cc/debug/debug_rect_history.cc
+++ b/cc/debug/debug_rect_history.cc
@@ -9,6 +9,7 @@
#include "cc/base/math_util.h"
#include "cc/layers/layer_impl.h"
#include "cc/layers/layer_iterator.h"
+#include "cc/layers/layer_list_iterator.h"
#include "cc/layers/layer_utils.h"
#include "cc/layers/render_surface_impl.h"
#include "cc/trees/damage_tracker.h"
@@ -65,23 +66,22 @@ void DebugRectHistory::SaveDebugRectsForCurrentFrame(
SaveLayerAnimationBoundsRects(render_surface_layer_list);
}
-void DebugRectHistory::SavePaintRects(LayerImpl* layer) {
+void DebugRectHistory::SavePaintRects(LayerImpl* root_layer) {
// We would like to visualize where any layer's paint rect (update rect) has
// changed, regardless of whether this layer is skipped for actual drawing or
- // not. Therefore we traverse recursively over all layers, not just the render
- // surface list.
+ // not. Therefore we traverse over all layers, not just the render surface
+ // list.
+ for (auto* layer : *root_layer->layer_tree_impl()) {
+ Region invalidation_region = layer->GetInvalidationRegion();
+ if (invalidation_region.IsEmpty() || !layer->DrawsContent())
+ continue;
- Region invalidation_region = layer->GetInvalidationRegion();
- if (!invalidation_region.IsEmpty() && layer->DrawsContent()) {
for (Region::Iterator it(invalidation_region); it.has_rect(); it.next()) {
debug_rects_.push_back(DebugRect(
PAINT_RECT_TYPE, MathUtil::MapEnclosingClippedRect(
layer->ScreenSpaceTransform(), it.rect())));
}
}
-
- for (unsigned i = 0; i < layer->children().size(); ++i)
- SavePaintRects(layer->children()[i].get());
}
void DebugRectHistory::SavePropertyChangedRects(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698