diff options
author | miu <miu@chromium.org> | 2015-05-29 16:57:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-29 23:57:41 +0000 |
commit | 1ab506aa9720454e32b815090a3fa3dd8d7145bc (patch) | |
tree | 04f6d6885936d1cc23228ce4b6e8ecb3c483262e /cc/debug/rendering_stats_instrumentation.cc | |
parent | 6cccd7e7965c94f7a7872addca15efaf1a4fd168 (diff) | |
download | chromium_src-1ab506aa9720454e32b815090a3fa3dd8d7145bc.zip chromium_src-1ab506aa9720454e32b815090a3fa3dd8d7145bc.tar.gz chromium_src-1ab506aa9720454e32b815090a3fa3dd8d7145bc.tar.bz2 |
Fixit: Fork base::TimeTicks --> TimeTicks + ThreadTicks + TraceTicks
TimeTicks was being overused for time values from three different clock
sources. This change splits the class into three separate classes: The
general-purpose monotonic time (TimeTicks), the thread-local run time
(ThreadTicks), and the global system trace time (TraceTicks). With this
change, the compiler is now able to use type-checking to guarantee
values from different clocks are not being mixed when doing time math.
This is the 2nd in a two-part change. Part 1 factored-out the
comparison and math operator overloads common to base::Time and
base::TimeTicks into a templated base class. The new ThreadTicks and
TraceTicks time classes also inherit from that base class.
Updated base/trace_event/* and a handful of outside-of-base uses of
ThreadNow() and NowFromSystemTraceTime() to use the new classes. A bug
was identified and fixed, in src/ui/gl/angle_platform_impl.cc, where
values from TimeTicks::Now() were being erroneously provided to
base::TraceEvent instead of values from NowFromSystemTraceTime().
BUG=467417
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
NOTRY=true
Review URL: https://codereview.chromium.org/1122153002
Cr-Commit-Position: refs/heads/master@{#332080}
Diffstat (limited to 'cc/debug/rendering_stats_instrumentation.cc')
-rw-r--r-- | cc/debug/rendering_stats_instrumentation.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/cc/debug/rendering_stats_instrumentation.cc b/cc/debug/rendering_stats_instrumentation.cc index 7497c62..315743b 100644 --- a/cc/debug/rendering_stats_instrumentation.cc +++ b/cc/debug/rendering_stats_instrumentation.cc @@ -37,21 +37,21 @@ void RenderingStatsInstrumentation::AccumulateAndClearImplThreadStats() { impl_thread_rendering_stats_ = RenderingStats(); } -base::TimeTicks RenderingStatsInstrumentation::StartRecording() const { +base::TimeDelta RenderingStatsInstrumentation::StartRecording() const { if (record_rendering_stats_) { - if (base::TimeTicks::IsThreadNowSupported()) - return base::TimeTicks::ThreadNow(); - return base::TimeTicks::Now(); + if (base::ThreadTicks::IsSupported()) + return base::ThreadTicks::Now() - base::ThreadTicks(); + return base::TimeTicks::Now() - base::TimeTicks(); } - return base::TimeTicks(); + return base::TimeDelta(); } base::TimeDelta RenderingStatsInstrumentation::EndRecording( - base::TimeTicks start_time) const { - if (!start_time.is_null()) { - if (base::TimeTicks::IsThreadNowSupported()) - return base::TimeTicks::ThreadNow() - start_time; - return base::TimeTicks::Now() - start_time; + base::TimeDelta start_time) const { + if (start_time != base::TimeDelta()) { + if (base::ThreadTicks::IsSupported()) + return (base::ThreadTicks::Now() - base::ThreadTicks()) - start_time; + return (base::TimeTicks::Now() - base::TimeTicks()) - start_time; } return base::TimeDelta(); } |