Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Issue 1122153002: Fixit: Fork base::TimeTicks --> TimeTicks + ThreadTicks + TraceTicks (Closed)

Created:
5 years, 7 months ago by miu
Modified:
5 years, 6 months ago
CC:
aandrey+blink_chromium.org, cc-bugs_chromium.org, chromium-reviews, darin-cc_chromium.org, devtools-reviews_chromium.org, erikwright+watch_chromium.org, jam, jdduke+watch_chromium.org, jln+watch_chromium.org, mkwst+moarreviews-renderer_chromium.org, mlamouri+watch-content_chromium.org, pfeldman, piman+watch_chromium.org, rickyz+watch_chromium.org, sadrul, tdresser+watch_chromium.org, tracing+reviews_chromium.org, wfh+watch_chromium.org, yurys
Base URL:
https://chromium.googlesource.com/chromium/src.git@FIXIT_timeclasses_1of2
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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 Committed: https://crrev.com/1ab506aa9720454e32b815090a3fa3dd8d7145bc Cr-Commit-Position: refs/heads/master@{#332080}

Patch Set 1 #

Patch Set 2 : rebase #

Total comments: 12

Patch Set 3 : Better time.h comments. Using CheckedNumeric in time_mac.cc and time_posix.cc. #

Total comments: 15

Patch Set 4 : Comment tweaks in base/time/time.h #

Total comments: 2

Patch Set 5 : Comment tweak, plus dcheng's int64_t nit. [+REBASE] #

Total comments: 4

Patch Set 6 : formatting nit #

Patch Set 7 : REBASE #

Patch Set 8 : REBASE after it passed CQ but did not commit to tree #

Unified diffs Side-by-side diffs Delta from patch set Stats (+402 lines, -285 lines) Patch
M base/message_loop/message_pump_perftest.cc View 1 2 3 4 5 6 3 chunks +6 lines, -6 lines 0 comments Download
M base/threading/thread_perftest.cc View 4 chunks +8 lines, -8 lines 0 comments Download
M base/time/time.h View 1 2 3 4 5 4 chunks +122 lines, -55 lines 0 comments Download
M base/time/time.cc View 1 1 chunk +10 lines, -0 lines 0 comments Download
M base/time/time_mac.cc View 1 2 3 4 5 6 5 chunks +17 lines, -15 lines 0 comments Download
M base/time/time_posix.cc View 1 2 3 4 5 6 3 chunks +23 lines, -29 lines 0 comments Download
M base/time/time_unittest.cc View 1 2 3 4 5 6 2 chunks +8 lines, -7 lines 0 comments Download
M base/time/time_win.cc View 1 2 3 4 5 6 9 chunks +21 lines, -19 lines 0 comments Download
M base/time/time_win_unittest.cc View 2 chunks +4 lines, -3 lines 0 comments Download
M base/trace_event/trace_event.h View 1 14 chunks +28 lines, -14 lines 0 comments Download
M base/trace_event/trace_event_android.cc View 1 chunk +1 line, -2 lines 0 comments Download
M base/trace_event/trace_event_impl.h View 1 2 3 4 5 6 10 chunks +16 lines, -16 lines 0 comments Download
M base/trace_event/trace_event_impl.cc View 1 2 3 4 5 6 12 chunks +24 lines, -24 lines 0 comments Download
M base/trace_event/trace_event_unittest.cc View 1 2 3 4 5 6 4 chunks +8 lines, -12 lines 0 comments Download
M cc/debug/lap_timer.h View 1 chunk +1 line, -1 line 0 comments Download
M cc/debug/lap_timer.cc View 2 chunks +8 lines, -4 lines 0 comments Download
M cc/debug/rendering_stats_instrumentation.h View 1 chunk +2 lines, -2 lines 0 comments Download
M cc/debug/rendering_stats_instrumentation.cc View 1 chunk +10 lines, -10 lines 0 comments Download
M cc/scheduler/begin_frame_tracker.h View 1 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
M cc/scheduler/begin_frame_tracker.cc View 1 2 3 4 5 6 4 chunks +8 lines, -6 lines 0 comments Download
M components/tracing/child_trace_message_filter.h View 1 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
M components/tracing/child_trace_message_filter.cc View 1 2 3 4 5 6 2 chunks +3 lines, -4 lines 0 comments Download
M components/tracing/tracing_messages.h View 2 chunks +2 lines, -2 lines 0 comments Download
M content/browser/tracing/etw_system_event_consumer_win.cc View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/tracing/trace_message_filter.cc View 2 chunks +3 lines, -3 lines 0 comments Download
M content/child/blink_platform_impl.cc View 1 2 3 4 5 6 3 chunks +5 lines, -6 lines 0 comments Download
M content/renderer/devtools/v8_sampling_profiler.cc View 1 2 3 4 5 6 4 chunks +6 lines, -6 lines 0 comments Download
M gpu/perftests/measurements.h View 1 chunk +2 lines, -2 lines 0 comments Download
M gpu/perftests/measurements.cc View 3 chunks +8 lines, -8 lines 0 comments Download
M ipc/ipc_message_utils.h View 1 2 3 4 5 6 7 2 chunks +9 lines, -0 lines 0 comments Download
M ipc/ipc_message_utils.cc View 1 2 1 chunk +19 lines, -0 lines 0 comments Download
M ppapi/shared_impl/ppb_trace_event_impl.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h View 1 chunk +1 line, -1 line 0 comments Download
M sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions_unittests.cc View 1 2 3 4 5 6 2 chunks +3 lines, -3 lines 0 comments Download
M ui/events/latency_info.cc View 1 2 1 chunk +4 lines, -4 lines 0 comments Download
M ui/gl/angle_platform_impl.cc View 1 2 3 4 5 6 2 chunks +3 lines, -4 lines 0 comments Download
M ui/gl/gpu_timing.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 37 (11 generated)
miu
Now that part 1 [finally] landed successfully, here's part 2. PTAL at base/time/*, and if ...
5 years, 7 months ago (2015-05-12 00:45:25 UTC) #2
Lei Zhang
base/time* generally looks good. Some nits and random ramblings below. https://codereview.chromium.org/1122153002/diff/20001/base/time/time.h File base/time/time.h (right): https://codereview.chromium.org/1122153002/diff/20001/base/time/time.h#newcode22 ...
5 years, 7 months ago (2015-05-13 23:31:47 UTC) #3
mithro-old
LGTM at a high level, thanks for doing this! I'll leave it to Lei Zhang ...
5 years, 7 months ago (2015-05-19 01:25:58 UTC) #5
miu
thestig: Addressed all coments. PTAL. https://codereview.chromium.org/1122153002/diff/20001/base/time/time.h File base/time/time.h (right): https://codereview.chromium.org/1122153002/diff/20001/base/time/time.h#newcode22 base/time/time.h:22: // On 2015/05/13 23:31:47, ...
5 years, 7 months ago (2015-05-19 03:14:32 UTC) #6
miu
Adding all remaining reviewers: cpu: Need quick-look and broad-scope OWNERS approval for changes in all ...
5 years, 7 months ago (2015-05-19 03:21:41 UTC) #8
cpu_(ooo_6.6-7.5)
this seems a good thing to do, some initial comments https://codereview.chromium.org/1122153002/diff/40001/base/time/time.h File base/time/time.h (right): https://codereview.chromium.org/1122153002/diff/40001/base/time/time.h#newcode7 ...
5 years, 7 months ago (2015-05-19 19:12:02 UTC) #9
miu
https://codereview.chromium.org/1122153002/diff/40001/base/time/time.h File base/time/time.h (right): https://codereview.chromium.org/1122153002/diff/40001/base/time/time.h#newcode7 base/time/time.h:7: // (1601-01-01 00:00:00 UTC) (See http://crbug.com/14734). System-dependent On 2015/05/19 ...
5 years, 7 months ago (2015-05-20 21:58:46 UTC) #10
miu
dcheng: Looks like jln@ is OOO. Can you do a security review for components/tracing/tracing_messages.h?
5 years, 7 months ago (2015-05-20 22:00:27 UTC) #12
dcheng
I'll take a look first thing tomorrow, if that's OK. On Wed, May 20, 2015, ...
5 years, 7 months ago (2015-05-20 22:09:28 UTC) #13
cpu_(ooo_6.6-7.5)
https://codereview.chromium.org/1122153002/diff/40001/base/time/time.h File base/time/time.h (right): https://codereview.chromium.org/1122153002/diff/40001/base/time/time.h#newcode25 base/time/time.h:25: // instance. Thus, they can be efficiently passed by-value ...
5 years, 7 months ago (2015-05-21 00:47:34 UTC) #14
Primiano Tucci (use gerrit)
The code changes themselves in base/trace_event and the general purpose of the CL look ok ...
5 years, 7 months ago (2015-05-21 08:11:34 UTC) #16
dcheng
ipc changes lgtm https://codereview.chromium.org/1122153002/diff/60001/base/time/time_mac.cc File base/time/time_mac.cc (right): https://codereview.chromium.org/1122153002/diff/60001/base/time/time_mac.cc#newcode25 base/time/time_mac.cc:25: int64 ComputeCurrentTicks() { Nit: we should ...
5 years, 7 months ago (2015-05-21 18:49:04 UTC) #17
miu
https://codereview.chromium.org/1122153002/diff/40001/base/time/time.h File base/time/time.h (right): https://codereview.chromium.org/1122153002/diff/40001/base/time/time.h#newcode32 base/time/time.h:32: // So many choices! Which time class should you ...
5 years, 7 months ago (2015-05-22 23:01:03 UTC) #18
miu
Ping to everyone! :) cpu: I responded to your comments and made some changes. I ...
5 years, 7 months ago (2015-05-27 20:21:01 UTC) #19
cpu_(ooo_6.6-7.5)
lgtm
5 years, 6 months ago (2015-05-28 22:48:11 UTC) #20
Lei Zhang
Yep, you've addressed all my previous comments. lgtm. https://codereview.chromium.org/1122153002/diff/80001/base/time/time.h File base/time/time.h (right): https://codereview.chromium.org/1122153002/diff/80001/base/time/time.h#newcode18 base/time/time.h:18: // ...
5 years, 6 months ago (2015-05-28 22:54:08 UTC) #21
dsinclair
https://codereview.chromium.org/1122153002/diff/80001/base/time/time.h File base/time/time.h (right): https://codereview.chromium.org/1122153002/diff/80001/base/time/time.h#newcode765 base/time/time.h:765: class BASE_EXPORT TraceTicks : public time_internal::TimeBase<TraceTicks> { How is ...
5 years, 6 months ago (2015-05-29 14:38:10 UTC) #22
miu
https://codereview.chromium.org/1122153002/diff/80001/base/time/time.h File base/time/time.h (right): https://codereview.chromium.org/1122153002/diff/80001/base/time/time.h#newcode765 base/time/time.h:765: class BASE_EXPORT TraceTicks : public time_internal::TimeBase<TraceTicks> { On 2015/05/29 ...
5 years, 6 months ago (2015-05-29 17:34:25 UTC) #23
dsinclair
base/trace_event lgtm
5 years, 6 months ago (2015-05-29 17:39:22 UTC) #24
miu
https://codereview.chromium.org/1122153002/diff/80001/base/time/time.h File base/time/time.h (right): https://codereview.chromium.org/1122153002/diff/80001/base/time/time.h#newcode18 base/time/time.h:18: // durations. Internally, they are represented in microseconds. They ...
5 years, 6 months ago (2015-05-29 19:54:18 UTC) #25
miu
Thanks everyone for reviewing! :)
5 years, 6 months ago (2015-05-29 20:22:49 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1122153002/120001
5 years, 6 months ago (2015-05-29 20:24:32 UTC) #29
commit-bot: I haz the power
Failed to apply patch for ipc/ipc_message_utils.h: While running git apply --index -3 -p1; error: patch ...
5 years, 6 months ago (2015-05-29 23:41:40 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1122153002/130001
5 years, 6 months ago (2015-05-29 23:52:43 UTC) #35
commit-bot: I haz the power
Committed patchset #8 (id:130001)
5 years, 6 months ago (2015-05-29 23:57:22 UTC) #36
commit-bot: I haz the power
5 years, 6 months ago (2015-05-29 23:58:12 UTC) #37
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/1ab506aa9720454e32b815090a3fa3dd8d7145bc
Cr-Commit-Position: refs/heads/master@{#332080}

Powered by Google App Engine
This is Rietveld 408576698