Bug 145384 - Introduce WTF::createRef<T>(Args&&...)
Summary: Introduce WTF::createRef<T>(Args&&...)
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Zan Dobersek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-26 13:22 PDT by Zan Dobersek
Modified: 2022-04-13 23:05 PDT (History)
8 users (show)

See Also:


Attachments
Test patch (3.13 KB, patch)
2015-05-26 13:25 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff
Test patch (6.67 KB, patch)
2015-05-28 09:14 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff
Test patch (32.89 KB, patch)
2015-05-29 03:48 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff
Patch (33.05 KB, patch)
2015-06-04 11:20 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff
Patch (37.11 KB, patch)
2015-06-06 07:26 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff
Patch (3.91 KB, patch)
2015-06-09 11:46 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>.