Bug 78740

Summary: Made Weak<T> single-owner, adding PassWeak<T>
Product: WebKit Reporter: Geoffrey Garen <ggaren>
Component: New BugsAssignee: Geoffrey Garen <ggaren>
Status: RESOLVED FIXED    
Severity: Normal CC: kling, mhahnenberg, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch sam: review+, webkit-ews: commit-queue-

Description Geoffrey Garen 2012-02-15 14:06:14 PST
Made Weak<T> single-owner, adding PassWeak<T>
Comment 1 Geoffrey Garen 2012-02-15 14:52:37 PST
Created attachment 127241 [details]
Patch
Comment 2 Geoffrey Garen 2012-02-15 14:58:26 PST
*** Bug 76335 has been marked as a duplicate of this bug. ***
Comment 3 Sam Weinig 2012-02-15 15:51:13 PST
Comment on attachment 127241 [details]
Patch

One idiom we have been adopting with other smart pointers in WebKit is that you never explicitly construct the Pass type, but rather have a friend function that does it, e.g. adoptPtr() and adoptRef().  Not sure that is necessary here but wanted to mention it.
Comment 4 Early Warning System Bot 2012-02-15 18:39:26 PST
Comment on attachment 127241 [details]
Patch

Attachment 127241 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/11529842
Comment 5 Geoffrey Garen 2012-02-16 17:12:03 PST
> One idiom we have been adopting with other smart pointers in WebKit is that you never explicitly construct the Pass type, but rather have a friend function that does it, e.g. adoptPtr() and adoptRef().  Not sure that is necessary here but wanted to mention it.

Why do we do that? I might be able to replicate something similar for PassWeak<T> if I understand the intention. It's not trivial replicable, though, because a PassWeak<T> needs to allocate a backing handle, which the client doesn't initially have available for adoption.
Comment 6 Geoffrey Garen 2012-02-16 17:26:47 PST
... I might be able to make it work in a future patch that makes the backing for a *Weak<T> an explicit object.
Comment 7 Geoffrey Garen 2012-02-16 17:56:19 PST
Committed r108010: <http://trac.webkit.org/changeset/108010>