Bug 126639 - Switch uses of WTF::bind in MockMediaPlayerMediaSource to C++11 lambdas
Summary: Switch uses of WTF::bind in MockMediaPlayerMediaSource to C++11 lambdas
Status: RESOLVED WONTFIX
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: 2014-01-08 07:32 PST by Zan Dobersek
Modified: 2016-08-30 01:47 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.28 KB, patch)
2014-01-08 07:34 PST, 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 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.