Bug 126639

Summary: Switch uses of WTF::bind in MockMediaPlayerMediaSource to C++11 lambdas
Product: WebKit Reporter: Zan Dobersek <zan>
Component: New BugsAssignee: Zan Dobersek <zan>
Status: RESOLVED WONTFIX    
Severity: Normal CC: andersca, commit-queue, eric.carlson, glenn, jer.noble
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Zan Dobersek 2014-01-08 07:32:40 PST
Switch uses of WTF::bind in MockMediaPlayerMediaSource to C++11 lambdas
Comment 1 Zan Dobersek 2014-01-08 07:34:17 PST
Created attachment 220630 [details]
Patch
Comment 2 Sergio Villar Senin 2014-01-31 07:10:52 PST
Comment on attachment 220630 [details]
Patch

lgtm
Comment 3 Jer Noble 2014-01-31 08:22:52 PST
Comment on attachment 220630 [details]
Patch

r=me
Comment 4 Jer Noble 2014-01-31 08:25:08 PST
Comment on attachment 220630 [details]
Patch

Actually, you should protect against this being freed before the lambda is called by passing in a RefPtr into the lambda.
Comment 5 Zan Dobersek 2014-01-31 11:55:32 PST
(In reply to comment #4)
> (From update of attachment 220630 [details])
> Actually, you should protect against this being freed before the lambda is called by passing in a RefPtr into the lambda.

MockMediaPlayerMediaSource is not ref-counted and is not derived from a ref-counted class (MediaPlayerPrivateInterface).

It's obvious it probably should be.
Comment 6 Jer Noble 2014-01-31 12:39:45 PST
(In reply to comment #5)
> (In reply to comment #4)
> > (From update of attachment 220630 [details] [details])
> > Actually, you should protect against this being freed before the lambda is called by passing in a RefPtr into the lambda.
> 
> MockMediaPlayerMediaSource is not ref-counted and is not derived from a ref-counted class (MediaPlayerPrivateInterface).
> 
> It's obvious it probably should be.

In this situation, you can use a WeakPtrFactory and WeakPtrs without making the class RefCounted.  Though you're right this class should probably be RefCounted.
Comment 7 Zan Dobersek 2016-08-30 01:46:52 PDT
WTF::bind() uses have been removed, making the patch stale.