Implement native event observer for linux.

This CL uses ui::PlatformEventSource observer API to hook into pre and post
native event dispatch on Linux.

Timestamps for X11 events are in X11 server time. The implementation makes a
round-trip to the X11 server to obtain a delta, and then uses that delta with
base::TimeTicks::Now() to convert to a base::TimeTicks.

The overhead from the rount-trip seems reasonable. 99th percentile X11 RTT is
3ms. 99.9th percentile is 16ms. 99.99th percentile is 40ms. These include the
time for syscalls to base::TimeTicks::Now().

To further reduce overhead, this CL changes the UMA metric to only be computed
with 1/1000 frequency, to avoid two calls to base::TimeTicks::Now().

Note: The implementation of native event observer will be turned on via Finch
experiment to measure overhead.

Change-Id: I786537f093e862a7a19630c9150606a2eb8267d9
Bug: 859155
Reviewed-on: https://chromium-review.googlesource.com/1162658
Reviewed-by: Timothy Dresser <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Alexander Timin <[email protected]>
Reviewed-by: Thomas Anderson <[email protected]>
Commit-Queue: Erik Chen <[email protected]>
Cr-Commit-Position: refs/heads/master@{#581304}
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
index 440979ab..993d0e7 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -2091,7 +2091,10 @@
 
   if (use_x11) {
     configs += [ "//build/config/linux:x11" ]
-    deps += [ "//ui/gfx/x" ]
+    deps += [
+      "//ui/events/platform/x11",
+      "//ui/gfx/x",
+    ]
   }
 
   if (use_pangocairo) {