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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 2672603007: cc : Add UMA metric for finding closest matching layer to a point (Closed)
Patch Set: Created 3 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 | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 1cf9fc54829a1078171a800e162db971d5be9cdc..5cb6ddb43da2608cbcf4c1696e5d529f1caff3e0 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -1881,32 +1881,37 @@ static void FindClosestMatchingLayer(const gfx::PointF& screen_space_point,
const Functor& func,
FindClosestMatchingLayerState* state) {
// We want to iterate from front to back when hit testing.
- for (auto* layer : base::Reversed(*root_layer->layer_tree_impl())) {
- if (!func(layer))
- continue;
+ {
+ base::ElapsedTimer timer;
+ for (auto* layer : base::Reversed(*root_layer->layer_tree_impl())) {
+ if (!func(layer))
+ continue;
- float distance_to_intersection = 0.f;
- bool hit = false;
- if (layer->Is3dSorted())
- hit =
- PointHitsLayer(layer, screen_space_point, &distance_to_intersection);
- else
- hit = PointHitsLayer(layer, screen_space_point, nullptr);
+ float distance_to_intersection = 0.f;
+ bool hit = false;
+ if (layer->Is3dSorted())
+ hit = PointHitsLayer(layer, screen_space_point,
+ &distance_to_intersection);
+ else
+ hit = PointHitsLayer(layer, screen_space_point, nullptr);
- if (!hit)
- continue;
+ if (!hit)
+ continue;
- bool in_front_of_previous_candidate =
- state->closest_match &&
- layer->GetSortingContextId() ==
- state->closest_match->GetSortingContextId() &&
- distance_to_intersection >
- state->closest_distance + std::numeric_limits<float>::epsilon();
+ bool in_front_of_previous_candidate =
+ state->closest_match &&
+ layer->GetSortingContextId() ==
+ state->closest_match->GetSortingContextId() &&
+ distance_to_intersection >
+ state->closest_distance + std::numeric_limits<float>::epsilon();
- if (!state->closest_match || in_front_of_previous_candidate) {
- state->closest_distance = distance_to_intersection;
- state->closest_match = layer;
+ if (!state->closest_match || in_front_of_previous_candidate) {
+ state->closest_distance = distance_to_intersection;
+ state->closest_match = layer;
+ }
}
+ UMA_HISTOGRAM_COUNTS("Compositing.LayerTreeImpl.FindClosestMatchingLayerUs",
+ timer.Elapsed().InMicroseconds());
}
}
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698