Chromium Code Reviews| Index: cc/trees/layer_tree_impl.cc |
| diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc |
| index d1cc0a03b932ee59abee2191f52c66bf0840613b..5fa7f68fee15b8c7a4e2153697a90f138af44237 100644 |
| --- a/cc/trees/layer_tree_impl.cc |
| +++ b/cc/trees/layer_tree_impl.cc |
| @@ -1882,31 +1882,41 @@ 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; |
| + } |
| + } |
| + if (const char* client_name = GetClientNameForMetrics()) { |
|
ajuma
2017/01/25 22:32:59
I don't think we do any of this hit testing in the
jaydasika
2017/01/25 22:53:47
Done.
|
| + UMA_HISTOGRAM_COUNTS( |
| + base::StringPrintf( |
| + "Compositing.%s.LayerTreeImpl.FindClosestMatchingLayerUs", |
| + client_name), |
| + timer.Elapsed().InMicroseconds()); |
| } |
| } |
| } |