Bug 144232 - Switch to std::function<>, std::bind() in MediaPlayerPrivateAVFoundationObjC
Summary: Switch to std::function<>, std::bind() in MediaPlayerPrivateAVFoundationObjC
Status: RESOLVED FIXED
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-04-26 11:35 PDT by Zan Dobersek
Modified: 2015-04-29 06:14 PDT (History)
1 user (show)

See Also:


Attachments
Patch (9.58 KB, patch)
2015-04-26 11:37 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff
Patch (10.61 KB, patch)
2015-04-27 23:50 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-04-26 11:35:31 PDT
Switch to std::function<>, std::bind() in MediaPlayerPrivateAVFoundationObjC
Comment 1 Zan Dobersek 2015-04-26 11:37:30 PDT
Created attachment 251701 [details]
Patch
Comment 2 Darin Adler 2015-04-26 11:55:37 PDT
Comment on attachment 251701 [details]
Patch

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

OK. I did a version of this that uses lambdas, but I guess this is more elegant.

r=me, only if you fix the problem with setAsset

> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:3189
> +    std::function<void()> function;

I think we decided to standardize on void () with the space. Anders did a patch recently about making this consistent.

> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:3221
> -            function = WTF::bind(&MediaPlayerPrivateAVFoundationObjC::setAsset, m_callback, RetainPtr<NSArray>(newValue));
> +            function = std::bind(&MediaPlayerPrivateAVFoundationObjC::setAsset, m_callback, newValue);

This introduces a bug. Nothing will retain/release the value and it could be deallocated by the time it runs on the main thread. Need to cast to some kind of RetainPtr.
Comment 3 Zan Dobersek 2015-04-27 23:50:00 PDT
Created attachment 251827 [details]
Patch

Uses RetainPtr<id> for ::setAsset().
Comment 4 WebKit Commit Bot 2015-04-27 23:51:41 PDT
Attachment 251827 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:3198:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Zan Dobersek 2015-04-29 06:14:13 PDT
Comment on attachment 251827 [details]
Patch

Clearing flags on attachment: 251827

Committed r183544: <http://trac.webkit.org/changeset/183544>
Comment 6 Zan Dobersek 2015-04-29 06:14:20 PDT
All reviewed patches have been landed.  Closing bug.