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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 1172583003: [DRAFT] Animations: Profile hash look-ups for external mutators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@implscroll
Patch Set: Created 5 years, 6 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 | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698