Bug 143413

Summary: [WK2] API::Array::copy() should move the resulting Vector<> of copies into the Array::create() call
Product: WebKit Reporter: Zan Dobersek <zan>
Component: New BugsAssignee: Zan Dobersek <zan>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch for landing none

Description Zan Dobersek 2015-04-04 22:38:11 PDT
[WK2] API::Array::copy() should move the resulting Vector<> of copies into the Array::create() call
Comment 1 Zan Dobersek 2015-04-04 22:40:59 PDT
Created attachment 250149 [details]
Patch
Comment 2 Zan Dobersek 2015-04-05 00:27:34 PDT
Created attachment 250151 [details]
Patch
Comment 3 Zan Dobersek 2015-04-05 00:31:21 PDT
Created attachment 250152 [details]
Patch
Comment 4 Darin Adler 2015-04-05 13:08:41 PDT
Comment on attachment 250152 [details]
Patch

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

> Source/WebKit2/Shared/API/APIArray.cpp:81
> +Array::Array(Vector<RefPtr<Object>>&& elements)

Seems like this function should be inlined.

> Source/WebKit2/Shared/API/APIArray.h:55
> +    static PassRefPtr<Array> create(Vector<RefPtr<Object>>&& elements);

I don’t think the name “elements” here adds anything.

> Source/WebKit2/Shared/API/APIArray.h:88
> +    explicit Array(Vector<RefPtr<Object>>&& elements);

I don’t think the name “elements” here adds anything.
Comment 5 Darin Adler 2015-04-05 13:09:13 PDT
Comment on attachment 250152 [details]
Patch

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

> Source/WebKit2/Shared/API/APIArray.h:54
>      static PassRefPtr<Array> create();

The return value of these functions should be changed to Ref<Array>.
Comment 6 Zan Dobersek 2015-04-06 01:57:52 PDT
Comment on attachment 250152 [details]
Patch

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

>> Source/WebKit2/Shared/API/APIArray.h:54
>>      static PassRefPtr<Array> create();
> 
> The return value of these functions should be changed to Ref<Array>.

That would make sense, but it's a bigger task since a lot of callers already operate on a PassRefPtr<> or are leaking or accessing the stored object through a pointer. Something for a separate bug.
Comment 7 Zan Dobersek 2015-04-06 02:03:59 PDT
Created attachment 250198 [details]
Patch for landing
Comment 8 Zan Dobersek 2015-04-06 02:55:59 PDT
Comment on attachment 250198 [details]
Patch for landing

Clearing flags on attachment: 250198

Committed r182388: <http://trac.webkit.org/changeset/182388>
Comment 9 Zan Dobersek 2015-04-06 02:56:07 PDT
All reviewed patches have been landed.  Closing bug.