Bug 145384

Summary: Introduce WTF::createRef<T>(Args&&...)
Product: WebKit Reporter: Zan Dobersek <zan>
Component: New BugsAssignee: Zan Dobersek <zan>
Status: NEW ---    
Severity: Normal CC: andersca, benjamin, cmarcelo, commit-queue, esprehn+autocc, Hironori.Fujii, kangil.han, zan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=238392
Attachments:
Description Flags
Test patch
none
Test patch
none
Test patch
none
Patch
none
Patch
none
Patch none

Description Zan Dobersek 2015-05-26 13:22:46 PDT
Introduce WTF::createRef<T>(Args&&...)
Comment 1 Zan Dobersek 2015-05-26 13:25:53 PDT
Created attachment 253727 [details]
Test patch

Checking how the EWSs handle it (specifically the friend template declaration).
Comment 2 Zan Dobersek 2015-05-28 09:14:15 PDT
Created attachment 253847 [details]
Test patch

Further iteration.
Comment 3 Zan Dobersek 2015-05-29 03:48:47 PDT
Created attachment 253900 [details]
Test patch

Another iteration, testing out modifying AsyncRequestImpl creation.
Comment 4 WebKit Commit Bot 2015-05-29 03:51:15 PDT
Attachment 253900 [details] did not pass style-queue:


ERROR: Source/WebKit2/Shared/AsyncRequest.h:77:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 1 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Zan Dobersek 2015-06-04 11:20:18 PDT
Created attachment 254279 [details]
Patch

Another run through the EWS.
Comment 6 WebKit Commit Bot 2015-06-04 11:23:01 PDT
Attachment 254279 [details] did not pass style-queue:


ERROR: Source/WebKit2/Shared/AsyncRequest.h:77:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 1 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Zan Dobersek 2015-06-06 07:26:38 PDT
Created attachment 254413 [details]
Patch

More of an RFC about the idea, approach and namings.
Comment 8 WebKit Commit Bot 2015-06-06 07:27:50 PDT
Attachment 254413 [details] did not pass style-queue:


ERROR: Source/WebKit2/Shared/AsyncRequest.h:77:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 1 in 12 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Anders Carlsson 2015-06-06 09:27:04 PDT
Comment on attachment 254413 [details]
Patch

This is an interesting idea, but we _could_ just put it as a static member function on RefCounted directly - that way the friend declaration would be less awkward.
Comment 10 Zan Dobersek 2015-06-09 09:59:57 PDT
(In reply to comment #9)
> Comment on attachment 254413 [details]
> Patch
> 
> This is an interesting idea, but we _could_ just put it as a static member
> function on RefCounted directly - that way the friend declaration would be
> less awkward.

Could you please elaborate on how the friend declaration would look? I ended up with a pretty similar declaration.

I chose createRef so that the name indicates the type of the returned value, much like std::make_unique<>() indicates that std::unique_ptr<> is returned.
Comment 11 Anders Carlsson 2015-06-09 10:04:57 PDT
(In reply to comment #10)
> 
> Could you please elaborate on how the friend declaration would look? I ended
> up with a pretty similar declaration.
> 

friend class RefCounted<MyClass>;
Comment 12 Zan Dobersek 2015-06-09 11:46:38 PDT
Created attachment 254583 [details]
Patch

Adds RefCounted<T>::create(), friends just RefCounted<T>.