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

Issue 2319053004: [Reland] Make canceling Timers fast. (Closed)

Created:
4 years, 3 months ago by alex clarke (OOO till 29th)
Modified:
4 years, 3 months ago
CC:
altimin, blink-reviews, blink-reviews-api_chromium.org, chromium-reviews, dglazkov+blink, esprehn, scheduler-bugs_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make canceling Timers fast. base::Closure recently got an IsCancelled method. Taking advantage of that the scheduler can short circuit a bunch of logic for cancelled tasks and avoid running them and the rest of the task selection machinery. On the new TimerPerfTest benchmark this makes running 10000 cancelled tasks aprox 50x - 60x faster (measured on Android and Linux). Note this patch reverts many of the changes made in https://codereview.chromium.org/2258713004 in favor of WeakPtr based cancellation as favored by the base owners. NOTE it's possible this might break https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20ASAN I was not able to reproduce the ASAN failure locally however I suspect it's due to the Timer getting swept away which should be fixed by the change in the latest patchset. BUG=605718, 638542, 645876 Committed: https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1 Committed: https://crrev.com/77f183aaf924ea7742df562455db8579607224e0 Cr-Original-Commit-Position: refs/heads/master@{#417621} Cr-Commit-Position: refs/heads/master@{#417931}

Patch Set 1 #

Patch Set 2 : Rebased #

Patch Set 3 : Add missing file #

Total comments: 4

Patch Set 4 : Remove mojo dep from the RunAllPerfTests.cpp #

Patch Set 5 : Address Sami's comments #

Patch Set 6 : Getting printf to work with size_t cross platform is too hard, use C++ io streams instead #

Total comments: 16

Patch Set 7 : Responding to feedback #

Patch Set 8 : Fix android linking problem #

Patch Set 9 : Move TimerPerfTest into web/ as requested #

Patch Set 10 : Revert change to third_party/WebKit/Source/platform/BUILD.gn #

Patch Set 11 : Speculative fix, don't call m_weakPtrFactory.revokeAll if canFire is false. #

Patch Set 12 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+311 lines, -893 lines) Patch
M third_party/WebKit/Source/platform/Timer.h View 4 chunks +5 lines, -35 lines 0 comments Download
M third_party/WebKit/Source/platform/Timer.cpp View 7 8 9 10 4 chunks +8 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h View 1 2 3 4 5 8 chunks +17 lines, -47 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc View 1 2 3 4 5 6 19 chunks +80 lines, -267 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc View 1 2 3 4 5 1 chunk +9 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_perftest.cc View 3 chunks +2 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc View 1 chunk +0 lines, -374 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/time_domain.cc View 1 2 2 chunks +10 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/work_queue.h View 4 chunks +4 lines, -16 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/work_queue.cc View 1 2 3 4 5 6 6 chunks +33 lines, -53 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc View 1 chunk +1 line, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc View 6 chunks +15 lines, -14 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc View 1 chunk +0 lines, -18 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/child/web_task_runner_impl.h View 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/child/web_task_runner_impl.cc View 1 chunk +8 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.h View 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc View 2 chunks +7 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/BUILD.gn View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
A third_party/WebKit/Source/web/tests/TimerPerfTest.cpp View 1 2 3 4 5 6 7 8 1 chunk +101 lines, -0 lines 0 comments Download
M third_party/WebKit/public/platform/WebTaskRunner.h View 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/public/platform/scheduler/base/task_queue.h View 1 chunk +0 lines, -43 lines 0 comments Download

Messages

Total messages: 78 (58 generated)
alex clarke (OOO till 29th)
PTAL
4 years, 3 months ago (2016-09-08 14:51:47 UTC) #6
Sami
lgtm https://codereview.chromium.org/2319053004/diff/40001/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc File third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc (right): https://codereview.chromium.org/2319053004/diff/40001/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc#newcode218 third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc:218: // Schedule a later call to MoveReadyDelayedTasksToDelayedWorkQueue.. nit: ...
4 years, 3 months ago (2016-09-08 16:35:02 UTC) #20
alex clarke (OOO till 29th)
All comments addressed https://codereview.chromium.org/2319053004/diff/40001/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc File third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc (right): https://codereview.chromium.org/2319053004/diff/40001/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc#newcode218 third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc:218: // Schedule a later call to ...
4 years, 3 months ago (2016-09-08 16:43:28 UTC) #21
haraken
https://codereview.chromium.org/2319053004/diff/100001/third_party/WebKit/Source/platform/Timer.cpp File third_party/WebKit/Source/platform/Timer.cpp (right): https://codereview.chromium.org/2319053004/diff/100001/third_party/WebKit/Source/platform/Timer.cpp#newcode127 third_party/WebKit/Source/platform/Timer.cpp:127: m_weakPtrFactory.revokeAll(); Maybe do we want to move this to ...
4 years, 3 months ago (2016-09-09 02:34:07 UTC) #30
alex clarke (OOO till 29th)
PTAL https://codereview.chromium.org/2319053004/diff/100001/third_party/WebKit/Source/platform/Timer.cpp File third_party/WebKit/Source/platform/Timer.cpp (right): https://codereview.chromium.org/2319053004/diff/100001/third_party/WebKit/Source/platform/Timer.cpp#newcode127 third_party/WebKit/Source/platform/Timer.cpp:127: m_weakPtrFactory.revokeAll(); On 2016/09/09 02:34:07, haraken wrote: > > ...
4 years, 3 months ago (2016-09-09 09:40:59 UTC) #31
haraken
https://codereview.chromium.org/2319053004/diff/100001/third_party/WebKit/Source/platform/testing/RunAllPerfTests.cpp File third_party/WebKit/Source/platform/testing/RunAllPerfTests.cpp (right): https://codereview.chromium.org/2319053004/diff/100001/third_party/WebKit/Source/platform/testing/RunAllPerfTests.cpp#newcode1 third_party/WebKit/Source/platform/testing/RunAllPerfTests.cpp:1: // Copyright (c) 2016 The Chromium Authors. All rights ...
4 years, 3 months ago (2016-09-09 13:19:53 UTC) #38
haraken
As discussed offline, let's move TimerPerfTest to web/tests/. With that fix, LGTM.
4 years, 3 months ago (2016-09-09 13:29:22 UTC) #39
alex clarke (OOO till 29th)
+jochen@ can you please review the change to third_party/WebKit/public/platform/WebTaskRunner.h
4 years, 3 months ago (2016-09-09 13:40:41 UTC) #43
jochen (gone - plz use gerrit)
lgtm
4 years, 3 months ago (2016-09-09 13:42:25 UTC) #45
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2319053004/160001
4 years, 3 months ago (2016-09-09 13:42:47 UTC) #49
commit-bot: I haz the power
Try jobs failed on following builders: cast_shell_linux on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/cast_shell_linux/builds/221967) linux_chromium_asan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, ...
4 years, 3 months ago (2016-09-09 13:43:35 UTC) #51
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2319053004/180001
4 years, 3 months ago (2016-09-09 13:46:09 UTC) #54
commit-bot: I haz the power
Committed patchset #10 (id:180001)
4 years, 3 months ago (2016-09-09 17:42:31 UTC) #56
commit-bot: I haz the power
Patchset 10 (id:??) landed as https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1 Cr-Commit-Position: refs/heads/master@{#417621}
4 years, 3 months ago (2016-09-09 17:46:38 UTC) #58
fs
A revert of this CL (patchset #10 id:180001) has been created in https://codereview.chromium.org/2326313003/ by fs@opera.com. ...
4 years, 3 months ago (2016-09-10 18:23:25 UTC) #59
alex clarke (OOO till 29th)
https://codereview.chromium.org/2319053004/diff/100001/third_party/WebKit/Source/platform/Timer.cpp File third_party/WebKit/Source/platform/Timer.cpp (right): https://codereview.chromium.org/2319053004/diff/100001/third_party/WebKit/Source/platform/Timer.cpp#newcode127 third_party/WebKit/Source/platform/Timer.cpp:127: m_weakPtrFactory.revokeAll(); On 2016/09/09 09:40:58, alex clarke wrote: > On ...
4 years, 3 months ago (2016-09-12 11:07:18 UTC) #66
Sami
lgtm to retry with the revokeAll() change.
4 years, 3 months ago (2016-09-12 13:51:36 UTC) #69
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2319053004/220001
4 years, 3 months ago (2016-09-12 13:56:44 UTC) #73
commit-bot: I haz the power
Committed patchset #12 (id:220001)
4 years, 3 months ago (2016-09-12 14:00:08 UTC) #76
commit-bot: I haz the power
4 years, 3 months ago (2016-09-12 14:02:07 UTC) #78
Message was sent while issue was closed.
Patchset 12 (id:??) landed as
https://crrev.com/77f183aaf924ea7742df562455db8579607224e0
Cr-Commit-Position: refs/heads/master@{#417931}

Powered by Google App Engine
This is Rietveld 408576698