Added a PausableElapsedTimer.

There are some cases where an elapsed timer that can be paused is
useful.

An example case is recording surface embedding time to UMA metric.
Currently, the surface embedding time is recorded by simply taking
the different between the TimeTicks of the surface id allocation time
and the TimeTicks of when Surface::OnWillBeDrawn is called.
However, it is possible that surface id is allocated when the Renderer
is not visible, i.e. when the child changes size while hidden.
In this case, the surface embedding time will be arbitrarily inflated
since Surface::OnWillBeDrawn will not be called until it becomes
visible.

By using a pausable elapsed timer, the surface embedding time can be
paused if the renderer is hidden, and resumed when it becomes visible
again.

Bug: 949967
Change-Id: Ide8e5b67a06bae7d3ca1352574c477f35e32369c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1576331
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Commit-Queue: Edwin Joe <ejoe@google.com>
Cr-Commit-Position: refs/heads/master@{#653372}
4 files changed