Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Issue 302093011: Oilpan: move the MediaPlayer and MediaPlayerClient objects to the heap. (Closed)

Created:
6 years, 6 months ago by sof
Modified:
6 years, 6 months ago
CC:
blink-reviews, jamesr, blink-reviews-html_chromium.org, Rik, pdr., philipj_slow, gasubic, fs, eric.carlson_apple.com, jbroman, danakj, feature-media-reviews_chromium.org, dglazkov+blink, nessy, krit, Stephen Chennney, vcarbune.chromium, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Oilpan: move the MediaPlayer and MediaPlayerClient objects to the heap. Move the implementation of the MediaPlayer objects to the heap, allowing it to be kept as a Member of its client object, the media element. The media element now first calls detach() on the media player when clearing out its reference. This is so that the media player object can explicitly and synchronously notify its dependent objects of the player object going away. In the case of Oilpan it will be swept out and destructed at the next GC. R= BUG=378229

Patch Set 1 #

Patch Set 2 : Move DummyBase from WebCore to WTF #

Total comments: 19

Patch Set 3 : Reset WebLayer if media element and player object die simult #

Patch Set 4 : Explicitly instantiate and export DummyBase<void> #

Total comments: 17

Patch Set 5 : Have MediaController weakly track its media elements #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+173 lines, -97 lines) Patch
M Source/core/html/HTMLMediaElement.h View 1 2 3 4 6 chunks +4 lines, -11 lines 0 comments Download
M Source/core/html/HTMLMediaElement.cpp View 1 2 3 4 10 chunks +34 lines, -28 lines 2 comments Download
M Source/core/html/MediaController.h View 1 2 3 4 4 chunks +6 lines, -3 lines 1 comment Download
M Source/core/html/MediaController.cpp View 1 2 3 4 17 chunks +48 lines, -35 lines 0 comments Download
M Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp View 1 chunk +0 lines, -6 lines 0 comments Download
M Source/platform/graphics/media/MediaPlayer.h View 4 chunks +11 lines, -4 lines 1 comment Download
M Source/platform/graphics/media/MediaPlayer.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/platform/heap/Handle.h View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M Source/web/WebMediaPlayerClientImpl.h View 1 2 5 chunks +9 lines, -5 lines 0 comments Download
M Source/web/WebMediaPlayerClientImpl.cpp View 5 chunks +56 lines, -4 lines 3 comments Download

Messages

Total messages: 22 (0 generated)
sof
Please take a look. Media player destruction is a bit ornery in places, but this ...
6 years, 6 months ago (2014-06-02 11:36:28 UTC) #1
zerny-chromium
oilpan lgtm. https://codereview.chromium.org/302093011/diff/20001/Source/platform/heap/Handle.h File Source/platform/heap/Handle.h (right): https://codereview.chromium.org/302093011/diff/20001/Source/platform/heap/Handle.h#newcode45 Source/platform/heap/Handle.h:45: class DummyBase { I think this needs ...
6 years, 6 months ago (2014-06-02 12:59:06 UTC) #2
sof
https://codereview.chromium.org/302093011/diff/20001/Source/platform/heap/Handle.h File Source/platform/heap/Handle.h (right): https://codereview.chromium.org/302093011/diff/20001/Source/platform/heap/Handle.h#newcode45 Source/platform/heap/Handle.h:45: class DummyBase { On 2014/06/02 12:59:07, zerny-chromium wrote: > ...
6 years, 6 months ago (2014-06-02 14:25:03 UTC) #3
haraken
https://codereview.chromium.org/302093011/diff/20001/Source/web/WebMediaPlayerClientImpl.cpp File Source/web/WebMediaPlayerClientImpl.cpp (right): https://codereview.chromium.org/302093011/diff/20001/Source/web/WebMediaPlayerClientImpl.cpp#newcode76 Source/web/WebMediaPlayerClientImpl.cpp:76: audioSourceProvider()->setClient(0); Instead of adding these lines, if possible, it ...
6 years, 6 months ago (2014-06-02 15:24:48 UTC) #4
sof
https://codereview.chromium.org/302093011/diff/20001/Source/web/WebMediaPlayerClientImpl.cpp File Source/web/WebMediaPlayerClientImpl.cpp (right): https://codereview.chromium.org/302093011/diff/20001/Source/web/WebMediaPlayerClientImpl.cpp#newcode79 Source/web/WebMediaPlayerClientImpl.cpp:79: m_client.clear(); On 2014/06/02 15:24:48, haraken wrote: > > hmm, ...
6 years, 6 months ago (2014-06-02 15:46:54 UTC) #5
haraken
https://codereview.chromium.org/302093011/diff/20001/Source/web/WebMediaPlayerClientImpl.cpp File Source/web/WebMediaPlayerClientImpl.cpp (right): https://codereview.chromium.org/302093011/diff/20001/Source/web/WebMediaPlayerClientImpl.cpp#newcode79 Source/web/WebMediaPlayerClientImpl.cpp:79: m_client.clear(); On 2014/06/02 15:46:55, sof wrote: > On 2014/06/02 ...
6 years, 6 months ago (2014-06-02 16:01:42 UTC) #6
sof
https://codereview.chromium.org/302093011/diff/20001/Source/web/WebMediaPlayerClientImpl.cpp File Source/web/WebMediaPlayerClientImpl.cpp (right): https://codereview.chromium.org/302093011/diff/20001/Source/web/WebMediaPlayerClientImpl.cpp#newcode79 Source/web/WebMediaPlayerClientImpl.cpp:79: m_client.clear(); On 2014/06/02 16:01:42, haraken wrote: > On 2014/06/02 ...
6 years, 6 months ago (2014-06-02 16:25:07 UTC) #7
haraken
https://codereview.chromium.org/302093011/diff/20001/Source/web/WebMediaPlayerClientImpl.cpp File Source/web/WebMediaPlayerClientImpl.cpp (right): https://codereview.chromium.org/302093011/diff/20001/Source/web/WebMediaPlayerClientImpl.cpp#newcode502 Source/web/WebMediaPlayerClientImpl.cpp:502: m_webAudioSourceProvider = 0; On 2014/06/02 16:25:08, sof wrote: > ...
6 years, 6 months ago (2014-06-02 16:32:39 UTC) #8
sof
https://codereview.chromium.org/302093011/diff/20001/Source/platform/heap/Handle.h File Source/platform/heap/Handle.h (right): https://codereview.chromium.org/302093011/diff/20001/Source/platform/heap/Handle.h#newcode45 Source/platform/heap/Handle.h:45: class DummyBase { On 2014/06/02 14:25:03, sof wrote: > ...
6 years, 6 months ago (2014-06-02 22:00:45 UTC) #9
sof
https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp File Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp#newcode332 Source/core/html/HTMLMediaElement.cpp:332: if (m_mediaController) { We should convert MediaController into keeping ...
6 years, 6 months ago (2014-06-03 05:16:22 UTC) #10
haraken
Mostly looks good. Let me ask a couple of clarifying questions. https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp File Source/core/html/HTMLMediaElement.cpp (right): ...
6 years, 6 months ago (2014-06-03 05:31:08 UTC) #11
sof
https://codereview.chromium.org/302093011/diff/60001/Source/web/WebMediaPlayerClientImpl.h File Source/web/WebMediaPlayerClientImpl.h (right): https://codereview.chromium.org/302093011/diff/60001/Source/web/WebMediaPlayerClientImpl.h#newcode133 Source/web/WebMediaPlayerClientImpl.h:133: OwnPtr<WebMediaPlayer> m_webMediaPlayer; On 2014/06/03 05:31:08, haraken wrote: > > ...
6 years, 6 months ago (2014-06-03 05:45:44 UTC) #12
haraken
https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp File Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp#newcode370 Source/core/html/HTMLMediaElement.cpp:370: mediaPlayerSetWebLayer(0); On 2014/06/03 05:31:08, haraken wrote: > > This ...
6 years, 6 months ago (2014-06-03 06:00:13 UTC) #13
sof
https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp File Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp#newcode370 Source/core/html/HTMLMediaElement.cpp:370: mediaPlayerSetWebLayer(0); On 2014/06/03 06:00:14, haraken wrote: > On 2014/06/03 ...
6 years, 6 months ago (2014-06-03 06:11:43 UTC) #14
haraken
On 2014/06/03 06:11:43, sof wrote: > https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp > File Source/core/html/HTMLMediaElement.cpp (right): > > https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp#newcode370 > ...
6 years, 6 months ago (2014-06-03 06:42:05 UTC) #15
sof
https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp File Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp#newcode337 Source/core/html/HTMLMediaElement.cpp:337: closeMediaSource(); On 2014/06/03 05:16:23, sof wrote: > This is ...
6 years, 6 months ago (2014-06-03 07:51:21 UTC) #16
sof
https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp File Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp#newcode3442 Source/core/html/HTMLMediaElement.cpp:3442: clearMediaPlayerAndAudioSourceProviderClient(); On 2014/06/03 05:31:08, haraken wrote: > > I ...
6 years, 6 months ago (2014-06-03 08:04:11 UTC) #17
sof
https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp File Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/302093011/diff/60001/Source/core/html/HTMLMediaElement.cpp#newcode332 Source/core/html/HTMLMediaElement.cpp:332: if (m_mediaController) { On 2014/06/03 05:16:23, sof wrote: > ...
6 years, 6 months ago (2014-06-03 08:17:05 UTC) #18
haraken
LGTM. Let's wait for an approval of acolwell. https://codereview.chromium.org/302093011/diff/80001/Source/web/WebMediaPlayerClientImpl.cpp File Source/web/WebMediaPlayerClientImpl.cpp (right): https://codereview.chromium.org/302093011/diff/80001/Source/web/WebMediaPlayerClientImpl.cpp#newcode75 Source/web/WebMediaPlayerClientImpl.cpp:75: if ...
6 years, 6 months ago (2014-06-03 09:19:47 UTC) #19
sof
Sorry, forgot to answer the question earlier. https://codereview.chromium.org/302093011/diff/80001/Source/web/WebMediaPlayerClientImpl.cpp File Source/web/WebMediaPlayerClientImpl.cpp (right): https://codereview.chromium.org/302093011/diff/80001/Source/web/WebMediaPlayerClientImpl.cpp#newcode502 Source/web/WebMediaPlayerClientImpl.cpp:502: m_webAudioSourceProvider = ...
6 years, 6 months ago (2014-06-03 16:35:31 UTC) #20
acolwell GONE FROM CHROMIUM
MediaPlayer and MediaPlayerClient are going away. There are several CLs in flight to remove pieces ...
6 years, 6 months ago (2014-06-03 19:23:07 UTC) #21
sof
6 years, 6 months ago (2014-06-03 19:52:44 UTC) #22
Thanks for filling me in on limited future of these objects.

If MediaPlayer+MediaPlayerClient is going away and you don't consider it worth
moving them to the heap, then I'm not going to invest any more time on this CL.

https://codereview.chromium.org/302093011/diff/80001/Source/core/html/HTMLMed...
File Source/core/html/HTMLMediaElement.cpp (right):

https://codereview.chromium.org/302093011/diff/80001/Source/core/html/HTMLMed...
Source/core/html/HTMLMediaElement.cpp:3442:
clearMediaPlayerAndAudioSourceProviderClient();
On 2014/06/03 19:23:08, acolwell wrote:
> Why is this done here? I believe this needs to occur after the
> m_audioSourceNode->lock() to avoid the audio thread from accessing the audio
> source provider during destruction.

"this" == closeMediaSource() ? clearMediaPlayerAndAudioSourceProviderClient()
has its own lock-unlock pairing.

It mirrors the ordering for clearMediaPlayer(), where closeMediaSource() is
called prior to clear...Client(); and there's no explicit lock there first.

IOW, I thought the lock call here was to control/protect the
MediaPlayer::create(this) call.

Powered by Google App Engine
This is Rietveld 408576698