Bug 161553 - [Mac] Remove unnecessary RetainPtr in NeverDestroyed value
Summary: [Mac] Remove unnecessary RetainPtr in NeverDestroyed value
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-02 15:25 PDT by Joseph Pecoraro
Modified: 2016-09-03 07:26 PDT (History)
2 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (1.47 KB, patch)
2016-09-02 15:26 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
[PATCH] Proposed Fix (1.47 KB, patch)
2016-09-02 15:42 PDT, Joseph Pecoraro
joepeck: review-
Details | Formatted Diff | Diff
[PATCH] Proposed Fix (1.45 KB, patch)
2016-09-02 15:44 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

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