Re-enable Event.Latency.HitTest* histograms with new ownership

The Event.Latency.HitTest* histograms were removed due to their noisy
nature. But the Rendering Core team looks at these and has used them
to find regressions, so we want them back, and we will own them.

This patch essentially reverts commit
ab878a2f504bde1cfd53496f62c15716fa225218 with additional changes to
owners in the histogram file.

Bug: None
Change-Id: Id2437e84510d05ec345e5ba5d7bc1154de38afd5
Reviewed-on: https://chromium-review.googlesource.com/c/1409903
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Robert Kaplow <rkaplow@chromium.org>
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#623562}
diff --git a/third_party/blink/renderer/core/layout/layout_view.cc b/third_party/blink/renderer/core/layout/layout_view.cc
index 45ec4ce..163b6ac 100644
--- a/third_party/blink/renderer/core/layout/layout_view.cc
+++ b/third_party/blink/renderer/core/layout/layout_view.cc
@@ -64,6 +64,34 @@
 
 namespace blink {
 
+namespace {
+
+class HitTestLatencyRecorder {
+ public:
+  HitTestLatencyRecorder(bool allows_child_frame_content)
+      : start_(CurrentTimeTicks()),
+        allows_child_frame_content_(allows_child_frame_content) {}
+
+  ~HitTestLatencyRecorder() {
+    TimeDelta duration = CurrentTimeTicks() - start_;
+    if (allows_child_frame_content_) {
+      DEFINE_STATIC_LOCAL(CustomCountHistogram, recursive_latency_histogram,
+                          ("Event.Latency.HitTestRecursive", 0, 10000000, 100));
+      recursive_latency_histogram.CountMicroseconds(duration);
+    } else {
+      DEFINE_STATIC_LOCAL(CustomCountHistogram, latency_histogram,
+                          ("Event.Latency.HitTest", 0, 10000000, 100));
+      latency_histogram.CountMicroseconds(duration);
+    }
+  }
+
+ private:
+  TimeTicks start_;
+  bool allows_child_frame_content_;
+};
+
+}  // namespace
+
 LayoutView::LayoutView(Document* document)
     : LayoutBlockFlow(document),
       frame_view_(document->View()),
@@ -107,6 +135,8 @@
   // iframe's inner document.
   if (!GetFrameView()->UpdateAllLifecyclePhasesExceptPaint())
     return false;
+  HitTestLatencyRecorder hit_test_latency_recorder(
+      result.GetHitTestRequest().AllowsChildFrameContent());
   return HitTestNoLifecycleUpdate(location, result);
 }
 
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index ff67b8d..9995223 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -28602,16 +28602,14 @@
 </histogram>
 
 <histogram name="Event.Latency.HitTest" units="microseconds">
-  <obsolete>
-    Deprecated 01/2019 due to lack of usage.
-  </obsolete>
-  <owner>dtapuska@chromium.org</owner>
+  <owner>paint-dev@chromium.org</owner>
+  <owner>schenney@chromium.org</owner>
   <summary>
     Duration of a non-resurive hitTest operation. The hit test is non-recursive
     when the AllowChildFrameContent flag is clear. See also
     Event.Latency.HitTestRecusrive.
 
-    Team: input-dev@chromium.org.
+    Team: paint-dev@chromium.org.
 
     Warning: This metric may include reports from clients with low-resolution
     clocks (i.e. on Windows, ref. |TimeTicks::IsHighResolution()|). Such reports
@@ -28622,15 +28620,13 @@
 </histogram>
 
 <histogram name="Event.Latency.HitTestRecursive" units="microseconds">
-  <obsolete>
-    Deprecated 01/2019 due to lack of usage.
-  </obsolete>
-  <owner>dtapuska@chromium.org</owner>
+  <owner>paint-dev@chromium.org</owner>
+  <owner>schenney@chromium.org</owner>
   <summary>
     Duration of a recursive hitTest operation. The hit test is recursive when
     the AllowChildFrameContent flag is set. See also Event.Latency.HitTest.
 
-    Team: input-dev@chromium.org.
+    Team: paint-dev@chromium.org.
 
     Warning: This metric may include reports from clients with low-resolution
     clocks (i.e. on Windows, ref. |TimeTicks::IsHighResolution()|). Such reports