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

Issue 2177283005: Add WTF::makeCancellable (Closed)

Created:
4 years, 4 months ago by tzik
Modified:
4 years, 4 months ago
CC:
chromium-reviews, blink-reviews, blink-reviews-wtf_chromium.org, Mikhail, yuryu
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add WTF::makeCancellable Current Blink code has several tricky code for Function cancellation, such as ImageLoader::Task, WorkerEventQueue::EventDispatcherTask, CancellableTaskFactory, and 0-delay oneshot timers. They essentially make code dups, and adds complexity to the code base. This CL adds WTF::makeCancellable() to unify them. Committed: https://crrev.com/e5b8b24c7412a07913e4fd0648d71624d09e6c55 Cr-Commit-Position: refs/heads/master@{#409457}

Patch Set 1 : update #

Patch Set 2 : s/run/runUnlessCancelled/ #

Patch Set 3 : update #

Patch Set 4 : +test, +DCHECK #

Total comments: 4

Patch Set 5 : +example #

Total comments: 7

Patch Set 6 : s/unless/if/ #

Patch Set 7 : s/FunctionCanceller/ScopedFunctionCanceller/, s/FunctionCancellerImplBase/FunctionCanceller/ #

Patch Set 8 : comment fix #

Total comments: 6

Patch Set 9 : +self-assign fix, +test, +comment and examples #

Total comments: 10

Patch Set 10 : update #

Patch Set 11 : +MakeCancellableResult #

Patch Set 12 : update comment #

Patch Set 13 : return ScopedFunctionCanceller. +operator bool #

Patch Set 14 : update #

Patch Set 15 : +comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+393 lines, -0 lines) Patch
A third_party/WebKit/Source/wtf/MakeCancellable.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +172 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/wtf/MakeCancellable.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +53 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/wtf/MakeCancellableTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +165 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/wtf.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +3 lines, -0 lines 0 comments Download

Messages

Total messages: 102 (74 generated)
tzik
PTAL
4 years, 4 months ago (2016-07-27 07:23:10 UTC) #27
Yuta Kitamura
Makes sense overall. https://codereview.chromium.org/2177283005/diff/100001/third_party/WebKit/Source/wtf/MakeCancellable.cpp File third_party/WebKit/Source/wtf/MakeCancellable.cpp (right): https://codereview.chromium.org/2177283005/diff/100001/third_party/WebKit/Source/wtf/MakeCancellable.cpp#newcode29 third_party/WebKit/Source/wtf/MakeCancellable.cpp:29: cancel(); This might be a bit ...
4 years, 4 months ago (2016-07-27 09:08:02 UTC) #30
tzik
https://codereview.chromium.org/2177283005/diff/100001/third_party/WebKit/Source/wtf/MakeCancellable.cpp File third_party/WebKit/Source/wtf/MakeCancellable.cpp (right): https://codereview.chromium.org/2177283005/diff/100001/third_party/WebKit/Source/wtf/MakeCancellable.cpp#newcode29 third_party/WebKit/Source/wtf/MakeCancellable.cpp:29: cancel(); On 2016/07/27 09:08:02, Yuta Kitamura wrote: > This ...
4 years, 4 months ago (2016-07-27 10:10:30 UTC) #31
haraken
https://codereview.chromium.org/2177283005/diff/120001/third_party/WebKit/Source/wtf/MakeCancellable.h File third_party/WebKit/Source/wtf/MakeCancellable.h (right): https://codereview.chromium.org/2177283005/diff/120001/third_party/WebKit/Source/wtf/MakeCancellable.h#newcode20 third_party/WebKit/Source/wtf/MakeCancellable.h:20: class WTF_EXPORT FunctionCancellerImplBase : public RefCounted<FunctionCancellerImplBase> { Do we ...
4 years, 4 months ago (2016-07-27 11:18:04 UTC) #34
tzik
https://codereview.chromium.org/2177283005/diff/120001/third_party/WebKit/Source/wtf/MakeCancellable.h File third_party/WebKit/Source/wtf/MakeCancellable.h (right): https://codereview.chromium.org/2177283005/diff/120001/third_party/WebKit/Source/wtf/MakeCancellable.h#newcode20 third_party/WebKit/Source/wtf/MakeCancellable.h:20: class WTF_EXPORT FunctionCancellerImplBase : public RefCounted<FunctionCancellerImplBase> { On 2016/07/27 ...
4 years, 4 months ago (2016-07-27 13:56:53 UTC) #37
haraken
https://codereview.chromium.org/2177283005/diff/120001/third_party/WebKit/Source/wtf/MakeCancellable.h File third_party/WebKit/Source/wtf/MakeCancellable.h (right): https://codereview.chromium.org/2177283005/diff/120001/third_party/WebKit/Source/wtf/MakeCancellable.h#newcode91 third_party/WebKit/Source/wtf/MakeCancellable.h:91: // std::tie(wrappedFunction, canceller) = makeCancellable(std::move(function)); On 2016/07/27 13:56:53, tzik ...
4 years, 4 months ago (2016-07-27 14:05:46 UTC) #38
tzik
On 2016/07/27 14:05:46, haraken wrote: > https://codereview.chromium.org/2177283005/diff/120001/third_party/WebKit/Source/wtf/MakeCancellable.h > File third_party/WebKit/Source/wtf/MakeCancellable.h (right): > > https://codereview.chromium.org/2177283005/diff/120001/third_party/WebKit/Source/wtf/MakeCancellable.h#newcode91 > ...
4 years, 4 months ago (2016-07-27 14:32:34 UTC) #39
haraken
On 2016/07/27 14:32:34, tzik wrote: > On 2016/07/27 14:05:46, haraken wrote: > > > https://codereview.chromium.org/2177283005/diff/120001/third_party/WebKit/Source/wtf/MakeCancellable.h ...
4 years, 4 months ago (2016-07-27 15:13:17 UTC) #40
tzik
On 2016/07/27 15:13:17, haraken wrote: > On 2016/07/27 14:32:34, tzik wrote: > > On 2016/07/27 ...
4 years, 4 months ago (2016-07-28 04:37:34 UTC) #48
Yuta Kitamura
https://codereview.chromium.org/2177283005/diff/200001/third_party/WebKit/Source/wtf/MakeCancellable.h File third_party/WebKit/Source/wtf/MakeCancellable.h (right): https://codereview.chromium.org/2177283005/diff/200001/third_party/WebKit/Source/wtf/MakeCancellable.h#newcode103 third_party/WebKit/Source/wtf/MakeCancellable.h:103: std::unique_ptr<Function<void(Params...)>> wrappedFunction = bind(&Canceller::runUnlessCancelled, canceller, ScopedFunctionCanceller(canceller)); I'm still unsure ...
4 years, 4 months ago (2016-07-29 00:57:42 UTC) #51
tzik
https://codereview.chromium.org/2177283005/diff/200001/third_party/WebKit/Source/wtf/MakeCancellable.h File third_party/WebKit/Source/wtf/MakeCancellable.h (right): https://codereview.chromium.org/2177283005/diff/200001/third_party/WebKit/Source/wtf/MakeCancellable.h#newcode103 third_party/WebKit/Source/wtf/MakeCancellable.h:103: std::unique_ptr<Function<void(Params...)>> wrappedFunction = bind(&Canceller::runUnlessCancelled, canceller, ScopedFunctionCanceller(canceller)); On 2016/07/29 00:57:42, ...
4 years, 4 months ago (2016-07-29 05:25:41 UTC) #52
Yuta Kitamura
OK, LGTM w/ nits. https://codereview.chromium.org/2177283005/diff/200001/third_party/WebKit/Source/wtf/MakeCancellable.h File third_party/WebKit/Source/wtf/MakeCancellable.h (right): https://codereview.chromium.org/2177283005/diff/200001/third_party/WebKit/Source/wtf/MakeCancellable.h#newcode28 third_party/WebKit/Source/wtf/MakeCancellable.h:28: class WTF_EXPORT ScopedFunctionCanceller { A ...
4 years, 4 months ago (2016-07-29 05:58:28 UTC) #53
haraken
On 2016/07/29 05:25:41, tzik wrote: > https://codereview.chromium.org/2177283005/diff/200001/third_party/WebKit/Source/wtf/MakeCancellable.h > File third_party/WebKit/Source/wtf/MakeCancellable.h (right): > > https://codereview.chromium.org/2177283005/diff/200001/third_party/WebKit/Source/wtf/MakeCancellable.h#newcode103 > ...
4 years, 4 months ago (2016-07-29 08:06:36 UTC) #54
haraken
On 2016/07/29 08:06:36, haraken wrote: > On 2016/07/29 05:25:41, tzik wrote: > > > https://codereview.chromium.org/2177283005/diff/200001/third_party/WebKit/Source/wtf/MakeCancellable.h ...
4 years, 4 months ago (2016-07-29 08:09:52 UTC) #55
tzik
On 2016/07/29 08:06:36, haraken wrote: > On 2016/07/29 05:25:41, tzik wrote: > > > https://codereview.chromium.org/2177283005/diff/200001/third_party/WebKit/Source/wtf/MakeCancellable.h ...
4 years, 4 months ago (2016-07-29 13:46:44 UTC) #58
tzik
https://codereview.chromium.org/2177283005/diff/200001/third_party/WebKit/Source/wtf/MakeCancellable.h File third_party/WebKit/Source/wtf/MakeCancellable.h (right): https://codereview.chromium.org/2177283005/diff/200001/third_party/WebKit/Source/wtf/MakeCancellable.h#newcode28 third_party/WebKit/Source/wtf/MakeCancellable.h:28: class WTF_EXPORT ScopedFunctionCanceller { On 2016/07/29 05:58:28, Yuta Kitamura ...
4 years, 4 months ago (2016-07-29 13:47:11 UTC) #59
haraken
https://codereview.chromium.org/2177283005/diff/220001/third_party/WebKit/Source/wtf/MakeCancellable.cpp File third_party/WebKit/Source/wtf/MakeCancellable.cpp (right): https://codereview.chromium.org/2177283005/diff/220001/third_party/WebKit/Source/wtf/MakeCancellable.cpp#newcode7 third_party/WebKit/Source/wtf/MakeCancellable.cpp:7: #include "base/logging.h" Do you need this? https://codereview.chromium.org/2177283005/diff/220001/third_party/WebKit/Source/wtf/MakeCancellable.h File third_party/WebKit/Source/wtf/MakeCancellable.h ...
4 years, 4 months ago (2016-07-29 14:02:52 UTC) #60
tzik
https://codereview.chromium.org/2177283005/diff/220001/third_party/WebKit/Source/wtf/MakeCancellable.cpp File third_party/WebKit/Source/wtf/MakeCancellable.cpp (right): https://codereview.chromium.org/2177283005/diff/220001/third_party/WebKit/Source/wtf/MakeCancellable.cpp#newcode7 third_party/WebKit/Source/wtf/MakeCancellable.cpp:7: #include "base/logging.h" On 2016/07/29 14:02:52, haraken wrote: > > ...
4 years, 4 months ago (2016-07-29 16:49:13 UTC) #69
haraken
https://codereview.chromium.org/2177283005/diff/220001/third_party/WebKit/Source/wtf/MakeCancellable.h File third_party/WebKit/Source/wtf/MakeCancellable.h (right): https://codereview.chromium.org/2177283005/diff/220001/third_party/WebKit/Source/wtf/MakeCancellable.h#newcode29 third_party/WebKit/Source/wtf/MakeCancellable.h:29: // function on its destruction. On 2016/07/29 16:49:13, tzik ...
4 years, 4 months ago (2016-07-29 19:18:39 UTC) #70
tzik
https://codereview.chromium.org/2177283005/diff/220001/third_party/WebKit/Source/wtf/MakeCancellable.h File third_party/WebKit/Source/wtf/MakeCancellable.h (right): https://codereview.chromium.org/2177283005/diff/220001/third_party/WebKit/Source/wtf/MakeCancellable.h#newcode29 third_party/WebKit/Source/wtf/MakeCancellable.h:29: // function on its destruction. On 2016/07/29 19:18:39, haraken ...
4 years, 4 months ago (2016-07-29 21:10:36 UTC) #75
haraken
On 2016/07/29 21:10:36, tzik wrote: > https://codereview.chromium.org/2177283005/diff/220001/third_party/WebKit/Source/wtf/MakeCancellable.h > File third_party/WebKit/Source/wtf/MakeCancellable.h (right): > > https://codereview.chromium.org/2177283005/diff/220001/third_party/WebKit/Source/wtf/MakeCancellable.h#newcode29 > ...
4 years, 4 months ago (2016-07-29 21:23:53 UTC) #76
tzik
On 2016/07/29 21:23:53, haraken wrote: > On 2016/07/29 21:10:36, tzik wrote: > > > https://codereview.chromium.org/2177283005/diff/220001/third_party/WebKit/Source/wtf/MakeCancellable.h ...
4 years, 4 months ago (2016-08-02 09:35:59 UTC) #91
haraken
On 2016/08/02 09:35:59, tzik wrote: > On 2016/07/29 21:23:53, haraken wrote: > > On 2016/07/29 ...
4 years, 4 months ago (2016-08-02 09:43:24 UTC) #92
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/2177283005/340001
4 years, 4 months ago (2016-08-03 04:44:38 UTC) #95
commit-bot: I haz the power
Committed patchset #15 (id:340001)
4 years, 4 months ago (2016-08-03 04:50:39 UTC) #97
commit-bot: I haz the power
Patchset 15 (id:??) landed as https://crrev.com/e5b8b24c7412a07913e4fd0648d71624d09e6c55 Cr-Commit-Position: refs/heads/master@{#409457}
4 years, 4 months ago (2016-08-03 04:52:28 UTC) #99
alexclarke
Can we reconsider? :) The problem is this adds yet another layer of abstraction to ...
4 years, 4 months ago (2016-08-10 09:36:28 UTC) #101
haraken
4 years, 4 months ago (2016-08-10 10:50:44 UTC) #102
Message was sent while issue was closed.
On 2016/08/10 09:36:28, alexclarke wrote:
> Can we reconsider? :) The problem is this adds yet another layer of
abstraction
> to achieve cancellation, but Sami and I are considering making cancellation
work
> natively in the scheduler.

Yes, we should.

I just chatted with Sami offline about it. Currently we have multiple classes to
create a cancellable task: CancellableTaskFactory, Timer, makeCancellable etc.
We need to figure out how to unify the design and APIs before increasing the
usage of makeCancellable.

Powered by Google App Engine
This is Rietveld 408576698