Index: cc/trees/layer_tree_host.cc |
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc |
index b5cb8592aacf260599406b921ecde77e97bbc939..8276479a347ea5f7749a6c4513f6a2b0e5e92af6 100644 |
--- a/cc/trees/layer_tree_host.cc |
+++ b/cc/trees/layer_tree_host.cc |
@@ -416,6 +416,12 @@ void LayerTreeHost::CommitComplete() { |
} |
} |
+void LayerTreeHost::DidCommitAndDrawFrame() { |
+ client_->DidCommitAndDrawFrame(); |
+ if (animation_host_) |
+ animation_host_->ReportAndClearStatsOnFrameEnd(); |
+} |
+ |
void LayerTreeHost::SetOutputSurface(scoped_ptr<OutputSurface> surface) { |
TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface"); |
DCHECK(output_surface_lost_); |
@@ -1186,6 +1192,7 @@ void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) { |
if (animation_host_) { |
if (animation_host_->AnimateLayers(monotonic_time)) |
animation_host_->UpdateAnimationState(true, &events); |
+ ReportAndClearStatsAfterAnimateLayers(); |
} else if (animation_registrar_) { |
if (animation_registrar_->AnimateLayers(monotonic_time)) |
animation_registrar_->UpdateAnimationState(true, &events); |
@@ -1330,7 +1337,9 @@ void LayerTreeHost::SetAuthoritativeVSyncInterval( |
} |
Layer* LayerTreeHost::LayerById(int id) const { |
+ base::TimeTicks start_time = base::TimeTicks::Now(); |
LayerIdMap::const_iterator iter = layer_id_map_.find(id); |
+ find_layer_by_id_stats_ += base::TimeTicks::Now() - start_time; |
return iter != layer_id_map_.end() ? iter->second : NULL; |
} |
@@ -1457,4 +1466,11 @@ bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { |
: false; |
} |
+void LayerTreeHost::ReportAndClearStatsAfterAnimateLayers() { |
+ LOCAL_HISTOGRAM_CUSTOM_COUNTS("Mutators.FindLayerById", |
+ find_layer_by_id_stats_.InMicroseconds(), 1, |
+ 1000, 10); |
+ find_layer_by_id_stats_ = base::TimeDelta(); |
+} |
+ |
} // namespace cc |