Bug 161553

Summary: [Mac] Remove unnecessary RetainPtr in NeverDestroyed value
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: WebCore Misc.Assignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, dbates
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
[PATCH] Proposed Fix
none
[PATCH] Proposed Fix
joepeck: review-
[PATCH] Proposed Fix none

Description Joseph Pecoraro 2016-09-02 15:25:36 PDT
Remove unnecessary RetainPtr in NeverDestroyed value:

    WebCore/platform/ios/WebCoreMotionManager.mm
    72:    static NeverDestroyed<RetainPtr<WebCoreMotionManager>> sharedMotionManager([[WebCoreMotionManager alloc] init]);

The NeverDestroyed can just hold the allocated pointer.
Comment 1 Joseph Pecoraro 2016-09-02 15:26:37 PDT
Created attachment 287825 [details]
[PATCH] Proposed Fix
Comment 2 Joseph Pecoraro 2016-09-02 15:27:53 PDT
Comment on attachment 287825 [details]
[PATCH] Proposed Fix

Typo.
Comment 3 Joseph Pecoraro 2016-09-02 15:42:06 PDT
Created attachment 287827 [details]
[PATCH] Proposed Fix
Comment 4 Joseph Pecoraro 2016-09-02 15:43:07 PDT
Comment on attachment 287827 [details]
[PATCH] Proposed Fix

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

> Source/WebCore/platform/ios/WebCoreMotionManager.mm:71
> +    static NeverDestroyed<WebCoreMotionManager *> sharedMotionManager([[WebCoreMotionManager alloc] init]);
> +    return sharedMotionManager.get();

Alternatively this could just be:

    static WebCoreMotionManager* sharedManager = [[WebCoreMotionManager alloc] init];
    return sharedMotionManager;

Which I think is probably the best. So I'll just write a patch for that!
Comment 5 Joseph Pecoraro 2016-09-02 15:44:47 PDT
Created attachment 287829 [details]
[PATCH] Proposed Fix
Comment 6 WebKit Commit Bot 2016-09-02 17:36:20 PDT
Comment on attachment 287829 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 287829

Committed r205391: <http://trac.webkit.org/changeset/205391>
Comment 7 WebKit Commit Bot 2016-09-02 17:36:24 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Darin Adler 2016-09-03 07:26:42 PDT
Comment on attachment 287829 [details]
[PATCH] Proposed Fix

Should we grep for NeverDestroyed and RetainPtr on the same line?