| 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());
|
| }
|
| }
|
|
|
|
|