Index: cc/trees/layer_tree_host_impl.cc |
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
index 9dc331f2bdc4e69301efd8aca4b48084732f602a..e9f02d71bfbf1a70a52179318eb0164ea2909375 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -1732,6 +1732,8 @@ bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { |
} |
} |
renderer_->SwapBuffers(metadata); |
+ if (animation_host_) |
+ animation_host_->ReportAndClearStatsOnFrameEnd(); |
return true; |
} |
@@ -3123,6 +3125,7 @@ void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time) { |
if (animation_host_) { |
if (animation_host_->AnimateLayers(monotonic_time)) |
SetNeedsAnimate(); |
+ ReportAndClearStatsAfterAnimateLayers(); |
} else { |
if (animation_registrar_->AnimateLayers(monotonic_time)) |
SetNeedsAnimate(); |
@@ -3617,4 +3620,23 @@ gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation( |
return gfx::ScrollOffset(); |
} |
+void LayerTreeHostImpl::ReportAndClearStatsAfterAnimateLayers() { |
+ base::TimeDelta find_layer_by_id_stats = |
+ active_tree_->find_layer_by_id_stats(); |
+ active_tree_->ClearStatsOnFrameEnd(); |
+ |
+ if (pending_tree_) { |
+ find_layer_by_id_stats += pending_tree_->find_layer_by_id_stats(); |
+ pending_tree_->ClearStatsOnFrameEnd(); |
+ } |
+ if (recycle_tree_) { |
+ find_layer_by_id_stats += recycle_tree_->find_layer_by_id_stats(); |
+ recycle_tree_->ClearStatsOnFrameEnd(); |
+ } |
+ |
+ LOCAL_HISTOGRAM_CUSTOM_COUNTS("Mutators.FindLayerImplById", |
+ find_layer_by_id_stats.InMicroseconds(), 1, |
+ 1000, 10); |
+} |
+ |
} // namespace cc |