Bug 144232

Summary: Switch to std::function<>, std::bind() in MediaPlayerPrivateAVFoundationObjC
Product: WebKit Reporter: Zan Dobersek <zan>
Component: New BugsAssignee: Zan Dobersek <zan>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

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.