Bug 177789

Summary: WeakPtr should have a move constructor
Product: WebKit Reporter: Geoffrey Garen <ggaren>
Component: New BugsAssignee: Geoffrey Garen <ggaren>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, buildbot, cdumez, cmarcelo, commit-queue, dbates, koivisto, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
zalan: review+, ggaren: commit-queue+
Patch
none
Patch none

Description Geoffrey Garen 2017-10-02 15:26:48 PDT
WeakPtr should have a move constructor
Comment 1 Geoffrey Garen 2017-10-02 15:27:37 PDT
Created attachment 322457 [details]
Patch
Comment 2 zalan 2017-10-02 15:43:19 PDT
Comment on attachment 322457 [details]
Patch

ofc
Comment 3 Chris Dumez 2017-10-02 15:52:39 PDT
Comment on attachment 322457 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322457&action=review

> Source/WTF/wtf/WeakPtr.h:77
> +    WeakPtr& operator=(const WeakPtr&) = default;

No WeakPtr& operator=(const WeakPtr&&) = default; ?
Comment 4 Chris Dumez 2017-10-02 15:53:21 PDT
Comment on attachment 322457 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322457&action=review

> Source/WTF/wtf/WeakPtr.h:70
>      WeakPtr(const WeakPtr& o) : m_ref(o.m_ref) { }

Can this one be = default; as well?
Comment 5 Geoffrey Garen 2017-10-02 15:59:42 PDT
Created attachment 322464 [details]
Patch
Comment 6 Chris Dumez 2017-10-02 16:02:25 PDT
Comment on attachment 322464 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322464&action=review

I think that if we just drop the custom copy constructor / assignment operator then we'd get implicit move constructor / assignment operators, no?

> Source/WTF/wtf/WeakPtr.h:77
> +    WeakPtr& operator=(const WeakPtr&) = default;

Why don't we want the WeakPtr& operator=(const WeakPtr&&) = default; too?
Comment 7 Chris Dumez 2017-10-02 16:03:27 PDT
Comment on attachment 322464 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322464&action=review

> Source/WTF/ChangeLog:3
> +        WeakPtr should have a move constructor

It would be good to API-test this change.
Comment 8 Geoffrey Garen 2017-10-02 16:54:48 PDT
Created attachment 322473 [details]
Patch
Comment 9 Chris Dumez 2017-10-02 16:57:37 PDT
Comment on attachment 322473 [details]
Patch

r=me
Comment 10 WebKit Commit Bot 2017-10-02 17:42:09 PDT
Comment on attachment 322473 [details]
Patch

Clearing flags on attachment: 322473

Committed r222764: <http://trac.webkit.org/changeset/222764>
Comment 11 WebKit Commit Bot 2017-10-02 17:42:10 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Radar WebKit Bug Importer 2017-10-02 17:43:18 PDT
<rdar://problem/34781637>