Added a PausableElapsedTimer.

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

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

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

Bug: 949967
Change-Id: Ide8e5b67a06bae7d3ca1352574c477f35e32369c
Reviewed-by: Jonathan Ross <>
Commit-Queue: Edwin Joe <>
Cr-Commit-Position: refs/heads/master@{#653372}
4 files changed