Fixit: Fork base::TimeTicks --> TimeTicks + ThreadTicks + TraceTicks
commit1ab506aa9720454e32b815090a3fa3dd8d7145bc
authormiu <miu@chromium.org>
Fri, 29 May 2015 23:57:12 +0000 (29 16:57 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 29 May 2015 23:57:41 +0000 (29 23:57 +0000)
tree04f6d6885936d1cc23228ce4b6e8ecb3c483262e
parent6cccd7e7965c94f7a7872addca15efaf1a4fd168
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}
38 files changed:
base/message_loop/message_pump_perftest.cc
base/threading/thread_perftest.cc
base/time/time.cc
base/time/time.h
base/time/time_mac.cc
base/time/time_posix.cc
base/time/time_unittest.cc
base/time/time_win.cc
base/time/time_win_unittest.cc
base/trace_event/trace_event.h
base/trace_event/trace_event_android.cc
base/trace_event/trace_event_impl.cc
base/trace_event/trace_event_impl.h
base/trace_event/trace_event_unittest.cc
cc/debug/lap_timer.cc
cc/debug/lap_timer.h
cc/debug/rendering_stats_instrumentation.cc
cc/debug/rendering_stats_instrumentation.h
cc/scheduler/begin_frame_tracker.cc
cc/scheduler/begin_frame_tracker.h
components/tracing/child_trace_message_filter.cc
components/tracing/child_trace_message_filter.h
components/tracing/tracing_messages.h
content/browser/tracing/etw_system_event_consumer_win.cc
content/browser/tracing/trace_message_filter.cc
content/child/blink_platform_impl.cc
content/renderer/devtools/v8_sampling_profiler.cc
gpu/perftests/measurements.cc
gpu/perftests/measurements.h
ipc/ipc_message_utils.cc
ipc/ipc_message_utils.h
ppapi/shared_impl/ppb_trace_event_impl.cc
sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions_unittests.cc
ui/events/latency_info.cc
ui/gl/angle_platform_impl.cc
ui/gl/gpu_timing.cc