Bug 131457

Summary: Remove unnecessary uses of std::move() in return statements
Product: WebKit Reporter: Zan Dobersek <zan>
Component: New BugsAssignee: Zan Dobersek <zan>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch darin: review+

Description Zan Dobersek 2014-04-09 14:53:29 PDT
Remove unnecessary uses of std::move() in return statements
Comment 1 Zan Dobersek 2014-04-09 14:56:05 PDT
Created attachment 228987 [details]
Patch
Comment 2 Darin Adler 2014-04-12 12:37:03 PDT
Comment on attachment 228987 [details]
Patch

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

> Source/WebCore/platform/RemoteCommandListener.cpp:34
> +    return std::unique_ptr<RemoteCommandListener>(new RemoteCommandListener(client));

This needs to use make_unique, not unique_ptr/new.

> Source/WebCore/platform/ios/RemoteCommandListenerIOS.mm:44
> +    return std::unique_ptr<RemoteCommandListener>(new RemoteCommandListenerIOS(client));

This needs to use make_unique, not unique_ptr/new.
Comment 3 Zan Dobersek 2014-04-13 07:19:49 PDT
Committed r167196: <http://trac.webkit.org/changeset/167196>
Comment 4 Zan Dobersek 2014-04-13 09:34:16 PDT
Comment on attachment 228987 [details]
Patch

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

>> Source/WebCore/platform/RemoteCommandListener.cpp:34
>> +    return std::unique_ptr<RemoteCommandListener>(new RemoteCommandListener(client));
> 
> This needs to use make_unique, not unique_ptr/new.

I managed to break the build by using std::make_unique() without the constructor being public, but I reverted back to using the std::unique_ptr<RemoteCommandListener> constructor rather than making the constructor accessible. Doing that wouldn't make much sense with RemoteCommandListener::create() set up to elegantly return an object of specific class on the iOS platform and an object of the general class on other platforms.

I'd rather address this once it becomes trivial to declare std::make_unique<>() as a friend of some specific class.