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

Issue 2322253002: Use WTF::WeakPtr in WTF::makeCancellable (Closed)

Created:
4 years, 3 months ago by tzik
Modified:
3 years, 9 months ago
CC:
chromium-reviews, blink-reviews, blink-reviews-wtf_chromium.org, Mikhail, Sami
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use WTF::WeakPtr in WTF::makeCancellable This CL modifies the cancellation mechanism of makeCancellable to use WeakPtr, instead of custom impl, so that base::Callback::IsCancelled work with the cancellation.

Patch Set 1 #

Patch Set 2 : +test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -4 lines) Patch
M third_party/WebKit/Source/wtf/MakeCancellable.h View 3 chunks +12 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/wtf/MakeCancellableTest.cpp View 1 8 chunks +13 lines, -0 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 39 (9 generated)
tzik
Alex, Daniel: We've decided to use just WeakPtr for the task cancellation, rather than postCancellableTask(). ...
4 years, 3 months ago (2016-09-09 14:53:39 UTC) #9
dcheng
One of the canonical examples is this: auto result = makeCancellable(bind(&Foo::bar, wrapPersistent(foo))); But that could ...
4 years, 3 months ago (2016-09-09 19:22:19 UTC) #10
alex clarke (OOO till 29th)
On 2016/09/09 14:53:39, tzik wrote: > Alex, Daniel: We've decided to use just WeakPtr for ...
4 years, 3 months ago (2016-09-09 19:47:43 UTC) #11
alex clarke (OOO till 29th)
On 2016/09/09 19:47:43, alex clarke wrote: > On 2016/09/09 14:53:39, tzik wrote: > > Alex, ...
4 years, 3 months ago (2016-09-09 20:04:44 UTC) #12
tzik
On 2016/09/09 19:22:19, dcheng wrote: > One of the canonical examples is this: > > ...
4 years, 3 months ago (2016-09-12 07:45:51 UTC) #13
alex clarke (OOO till 29th)
On 2016/09/12 07:45:51, tzik wrote: > On 2016/09/09 19:22:19, dcheng wrote: > > One of ...
4 years, 3 months ago (2016-09-12 15:00:06 UTC) #14
haraken
On 2016/09/12 15:00:06, alex clarke wrote: > On 2016/09/12 07:45:51, tzik wrote: > > On ...
4 years, 3 months ago (2016-09-12 15:03:13 UTC) #15
dcheng
On 2016/09/12 07:45:51, tzik wrote: > On 2016/09/09 19:22:19, dcheng wrote: > > One of ...
4 years, 3 months ago (2016-09-21 06:13:38 UTC) #16
tzik
On 2016/09/21 06:13:38, dcheng wrote: > On 2016/09/12 07:45:51, tzik wrote: > > On 2016/09/09 ...
4 years, 3 months ago (2016-09-21 06:59:16 UTC) #17
haraken
tzik@ has been going back and forth for a long time. Let's try to collect ...
4 years, 3 months ago (2016-09-21 07:50:42 UTC) #18
dcheng
On 2016/09/21 07:50:42, haraken wrote: > tzik@ has been going back and forth for a ...
4 years, 3 months ago (2016-09-22 06:01:16 UTC) #19
haraken
(Sorry, I didn't notice your reply -- I was kicked out from the cc list ...
4 years, 3 months ago (2016-09-23 07:56:50 UTC) #20
dcheng
On 2016/09/23 07:56:50, haraken wrote: > (Sorry, I didn't notice your reply -- I was ...
4 years, 3 months ago (2016-09-23 08:02:40 UTC) #21
haraken
On 2016/09/23 08:02:40, dcheng wrote: > On 2016/09/23 07:56:50, haraken wrote: > > (Sorry, I ...
4 years, 2 months ago (2016-09-25 23:21:32 UTC) #22
dcheng
On 2016/09/25 23:21:32, haraken wrote: > On 2016/09/23 08:02:40, dcheng wrote: > > On 2016/09/23 ...
4 years, 2 months ago (2016-09-25 23:41:31 UTC) #24
haraken
On 2016/09/25 23:41:31, dcheng wrote: > On 2016/09/25 23:21:32, haraken wrote: > > On 2016/09/23 ...
4 years, 2 months ago (2016-09-25 23:45:37 UTC) #25
tzik
On 2016/09/25 23:41:31, dcheng wrote: > On 2016/09/25 23:21:32, haraken wrote: > > On 2016/09/23 ...
4 years, 2 months ago (2016-09-26 04:51:52 UTC) #26
tzik
On 2016/09/26 04:51:52, tzik wrote: > On 2016/09/25 23:41:31, dcheng wrote: > > On 2016/09/25 ...
4 years, 2 months ago (2016-09-26 08:17:37 UTC) #27
haraken
tzik@ has been trying to invent a way to wrap an Oilpan pointer in WeakPtr<T> ...
4 years, 2 months ago (2016-09-28 09:03:41 UTC) #28
tzik
On 2016/09/28 09:03:41, haraken wrote: > tzik@ has been trying to invent a way to ...
4 years, 2 months ago (2016-09-28 13:59:15 UTC) #29
dcheng
On 2016/09/28 13:59:15, tzik wrote: > On 2016/09/28 09:03:41, haraken wrote: > > tzik@ has ...
4 years, 2 months ago (2016-09-29 01:30:14 UTC) #30
dcheng
On 2016/09/29 01:30:14, dcheng wrote: > On 2016/09/28 13:59:15, tzik wrote: > > On 2016/09/28 ...
4 years, 2 months ago (2016-09-29 02:34:22 UTC) #31
haraken
On 2016/09/29 02:34:22, dcheng wrote: > On 2016/09/29 01:30:14, dcheng wrote: > > On 2016/09/28 ...
4 years, 2 months ago (2016-09-29 02:37:24 UTC) #32
tzik
On 2016/09/29 01:30:14, dcheng wrote: > On 2016/09/28 13:59:15, tzik wrote: > > On 2016/09/28 ...
4 years, 2 months ago (2016-09-29 05:09:18 UTC) #33
haraken
On 2016/09/29 02:34:22, dcheng wrote: > On 2016/09/29 01:30:14, dcheng wrote: > > On 2016/09/28 ...
4 years, 2 months ago (2016-09-30 02:01:56 UTC) #34
dcheng
On 2016/09/30 02:01:56, haraken wrote: > On 2016/09/29 02:34:22, dcheng wrote: > > On 2016/09/29 ...
4 years, 2 months ago (2016-09-30 02:31:52 UTC) #35
haraken
On 2016/09/30 02:31:52, dcheng wrote: > On 2016/09/30 02:01:56, haraken wrote: > > On 2016/09/29 ...
4 years, 2 months ago (2016-09-30 02:32:54 UTC) #36
alex clarke (OOO till 29th)
On 2016/09/30 02:32:54, haraken wrote: > On 2016/09/30 02:31:52, dcheng wrote: > > On 2016/09/30 ...
4 years, 2 months ago (2016-10-04 09:43:59 UTC) #37
haraken
On 2016/10/04 09:43:59, alex clarke wrote: > On 2016/09/30 02:32:54, haraken wrote: > > On ...
4 years, 2 months ago (2016-10-04 11:46:23 UTC) #38
alex clarke (OOO till 29th)
4 years, 2 months ago (2016-10-04 12:36:15 UTC) #39
On 2016/10/04 11:46:23, haraken wrote:
> On 2016/10/04 09:43:59, alex clarke wrote:
> > On 2016/09/30 02:32:54, haraken wrote:
> > > On 2016/09/30 02:31:52, dcheng wrote:
> > > > On 2016/09/30 02:01:56, haraken wrote:
> > > > > On 2016/09/29 02:34:22, dcheng wrote:
> > > > > > On 2016/09/29 01:30:14, dcheng wrote:
> > > > > > > On 2016/09/28 13:59:15, tzik wrote:
> > > > > > > > On 2016/09/28 09:03:41, haraken wrote:
> > > > > > > > > tzik@ has been trying to invent a way to wrap an Oilpan
pointer
> in
> > > > > > > WeakPtr<T>
> > > > > > > > > but hasn't yet succeeded at the attempt for some complicated
> > reasons
> > > > > > (which
> > > > > > > > > tzik@ can explain in details).
> > > > > > > > > 
> > > > > > > > > dcheng@: Is there any option to add a helper function inside
> Blink
> > > > that
> > > > > > > > provides
> > > > > > > > > the postCancellableTask-style API? I'm curious whether your
> > concern
> > > is
> > > > > on
> > > > > > > > adding
> > > > > > > > > the postCancellableTask-style API to the public layer or on
> adding
> > > the
> > > > > API
> > > > > > > to
> > > > > > > > > the code base. If your concern is the former one, we can add a
> > > helper
> > > > > > > function
> > > > > > > > > only to Blink (not the public layer).
> > > > > > > > 
> > > > > > > > It turned out even adding traits is confusing to match with the
> > coding
> > > > > > > > convention of Oilpan.
> > > > > > > > We have to have 3 new variants of WeakPtrFactory for each
> > > > WeakPersistent,
> > > > > > > > CrossThreadWeakPersistent, and WeakMember, so that the owner of
> > > > > > WeakPtrFactory
> > > > > > > > can be GCed object or not. And we need 4 variants of WeakPtr for
> raw
> > > > > > pointer,
> > > > > > > > WP, CTWP, WM.
> > > > > > > > Also, WeakMember variants of WeakPtr and WeakPtrFactory need
> > > traceable.
> > > > > > > 
> > > > > > > WeakPtrFactory isn't thread-safe, so CTWP isn't an option anyway.
Is
> > > just
> > > > > > using
> > > > > > > WeakPersistent a big problem?
> > > > > > 
> > > > > > Btw, to unblock things, I'm OK with proceeding with something like
> this
> > if
> > > > we
> > > > > > can limit to Oilpan types. To me, it's not as bad if Oilpan has
> special
> > > > rules,
> > > > > > since it's memory model is not quite the same.
> > > > > > 
> > > > > > In the long-term, I would still like to converge these, but we can
> > figure
> > > > that
> > > > > > out without blocking further timer work. WDYT?
> > > > > 
> > > > > dcheng@: Just to confirm, what do you mean by 'something like this'?
Do
> > you
> > > > mean
> > > > > the postCancellableTask API not exposed to the public layer? Or do you
> > mean
> > > > > supporting many traits in WeakPtrFactory?
> > > > 
> > > > Sorry, I was not clear. I mean the current approach in this CL to add a
> new
> > > API
> > > > in Blink. I don't have a strong preference where we expose it; I would
> just
> > > > prefer that we static_assert that it's used for Oilpan for now.
> > WeakPtrFactory
> > > > has too many problems and we shouldn't block this work anymore.
> > > 
> > > Thanks for the clarification; makes sense!
> > 
> > Why is this actually better than CancellableTaskFactory?
> 
> See this thread for why the current CancellableTaskFactory is not nice:
>
https://groups.google.com/a/chromium.org/d/topic/platform-architecture-dev/f1...

Sorry I forgot about that thread, yes getting rid of CancellableTaskFactory
makes sense now.

> 
> You suggested the postCancellableTask API (although in the context of the
> task-handle-based implementation at that point), and as far as I read the
> thread, people liked the API. That's why we've tried to use the
> postCancellableTask API (on top of the weakptr-based implementation).
> 
> In any case, I'm getting tired of repeating the same discussion again and
again
> for one month. If you have any concerns, please raise all of your concerns and
> your suggestions on this thread. I'm happy to VC.

Powered by Google App Engine
This is Rietveld 408576698