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

Issue 509933002: Oilpan: Move MediaStreamSource, MediaStreamComponent and MediaStreamDescriptor to oilpan's heap

Created:
6 years, 3 months ago by haraken
Modified:
6 years, 3 months ago
CC:
blink-reviews, jamesr, philipj_slow, dglazkov+blink, eric.carlson_apple.com, abarth-chromium, feature-media-reviews_chromium.org, tommyw+watchlist_chromium.org, Raymond Toy
Project:
blink
Visibility:
Public.

Description

Oilpan: Move MediaStreamSource, MediaStreamComponent and MediaStreamDescriptor to oilpan's heap - MediaStreamSource, MediaStreamComponent and MediaStreamDescriptor must be moved to oilpan's heap in one go because their lifetime are tightly coupled. - Removed m_descriptor->setClient(0) from MediaStream's destructor. This is OK because MediaStreamDescriptor has a strong Member back to the Client (i.e., MediaStream). - Removed m_component->source()->removeObserver(this) from MediaStreamTrack's destructor. This is OK because this CL made the observers weak (i.e., MediaStreamSource::m_observers is a hash set of weak members to MediaStreamTrack objects). - Removed WebMediaStreamTrack::ExtraData::m_owner because it's unused. BUG=340522 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=181204

Patch Set 1 #

Total comments: 6

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Total comments: 2

Patch Set 7 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+212 lines, -132 lines) Patch
M Source/modules/mediastream/MediaStream.h View 1 2 3 4 5 3 chunks +4 lines, -4 lines 0 comments Download
M Source/modules/mediastream/MediaStream.cpp View 1 2 3 4 5 6 3 chunks +4 lines, -3 lines 0 comments Download
M Source/modules/mediastream/MediaStreamRegistry.h View 2 chunks +2 lines, -1 line 0 comments Download
M Source/modules/mediastream/MediaStreamTrack.h View 1 2 3 4 5 2 chunks +2 lines, -2 lines 0 comments Download
M Source/modules/mediastream/MediaStreamTrack.cpp View 1 2 3 4 5 6 3 chunks +5 lines, -4 lines 0 comments Download
M Source/modules/mediastream/RTCStatsRequestImpl.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/mediastream/RTCStatsRequestImpl.cpp View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M Source/modules/mediastream/UserMediaRequest.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/mediastream/UserMediaRequest.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/webaudio/MediaStreamAudioDestinationNode.h View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/webaudio/MediaStreamAudioDestinationNode.cpp View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M Source/platform/exported/WebMediaStream.cpp View 2 chunks +1 line, -11 lines 0 comments Download
M Source/platform/exported/WebMediaStreamSource.cpp View 1 2 3 4 5 2 chunks +1 line, -6 lines 0 comments Download
M Source/platform/exported/WebMediaStreamTrack.cpp View 3 chunks +0 lines, -26 lines 0 comments Download
M Source/platform/mediastream/MediaStreamComponent.h View 1 2 3 4 5 4 chunks +10 lines, -7 lines 0 comments Download
M Source/platform/mediastream/MediaStreamComponent.cpp View 1 2 3 4 5 2 chunks +36 lines, -5 lines 0 comments Download
M Source/platform/mediastream/MediaStreamDescriptor.h View 1 2 3 4 5 6 4 chunks +15 lines, -13 lines 0 comments Download
M Source/platform/mediastream/MediaStreamDescriptor.cpp View 1 2 3 4 5 6 5 chunks +43 lines, -10 lines 0 comments Download
M Source/platform/mediastream/MediaStreamSource.h View 1 2 3 4 5 6 4 chunks +11 lines, -7 lines 0 comments Download
M Source/platform/mediastream/MediaStreamSource.cpp View 1 2 3 4 5 6 3 chunks +40 lines, -11 lines 0 comments Download
M Source/web/WebHeap.cpp View 1 2 3 4 5 6 2 chunks +17 lines, -1 line 0 comments Download
M public/platform/WebMediaStream.h View 1 chunk +1 line, -3 lines 0 comments Download
M public/platform/WebMediaStreamSource.h View 1 3 chunks +7 lines, -2 lines 0 comments Download
M public/platform/WebMediaStreamTrack.h View 2 chunks +1 line, -12 lines 0 comments Download
M public/web/WebHeap.h View 1 2 3 4 5 6 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 36 (11 generated)
haraken
haraken@chromium.org changed reviewers: + oilpan-reviews@chromium.org, tkent@chromium.org
6 years, 3 months ago (2014-08-27 12:29:51 UTC) #1
haraken
PTAL https://codereview.chromium.org/509933002/diff/1/public/platform/WebMediaStreamSource.h File public/platform/WebMediaStreamSource.h (right): https://codereview.chromium.org/509933002/diff/1/public/platform/WebMediaStreamSource.h#newcode66 public/platform/WebMediaStreamSource.h:66: MediaStreamSource* m_owner; I'm not sure if I'm doing ...
6 years, 3 months ago (2014-08-27 12:33:56 UTC) #2
zerny-chromium
zerny@chromium.org changed reviewers: + zerny@chromium.org
6 years, 3 months ago (2014-08-27 13:21:53 UTC) #3
zerny-chromium
lgtm https://codereview.chromium.org/509933002/diff/1/public/platform/WebMediaStreamSource.h File public/platform/WebMediaStreamSource.h (right): https://codereview.chromium.org/509933002/diff/1/public/platform/WebMediaStreamSource.h#newcode66 public/platform/WebMediaStreamSource.h:66: MediaStreamSource* m_owner; On 2014/08/27 12:33:56, haraken wrote: > ...
6 years, 3 months ago (2014-08-27 13:21:53 UTC) #4
haraken
Thanks for review. I'll wait for tkent-san's comment on WebMediaStreamSource::m_owner. https://codereview.chromium.org/509933002/diff/1/public/platform/WebMediaStreamTrack.h File public/platform/WebMediaStreamTrack.h (left): https://codereview.chromium.org/509933002/diff/1/public/platform/WebMediaStreamTrack.h#oldcode54 ...
6 years, 3 months ago (2014-08-27 13:24:55 UTC) #5
tkent
https://codereview.chromium.org/509933002/diff/1/public/platform/WebMediaStreamSource.h File public/platform/WebMediaStreamSource.h (right): https://codereview.chromium.org/509933002/diff/1/public/platform/WebMediaStreamSource.h#newcode66 public/platform/WebMediaStreamSource.h:66: MediaStreamSource* m_owner; On 2014/08/27 13:21:53, zerny-chromium wrote: > On ...
6 years, 3 months ago (2014-09-01 06:59:47 UTC) #6
haraken
PTAL https://codereview.chromium.org/509933002/diff/1/public/platform/WebMediaStreamSource.h File public/platform/WebMediaStreamSource.h (right): https://codereview.chromium.org/509933002/diff/1/public/platform/WebMediaStreamSource.h#newcode66 public/platform/WebMediaStreamSource.h:66: MediaStreamSource* m_owner; On 2014/09/01 06:59:46, tkent wrote: > ...
6 years, 3 months ago (2014-09-01 07:10:44 UTC) #7
tkent
lgtm
6 years, 3 months ago (2014-09-01 07:56:24 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/haraken@chromium.org/509933002/20001
6 years, 3 months ago (2014-09-01 07:56:57 UTC) #10
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: win_blink_rel on tryserver.blink ...
6 years, 3 months ago (2014-09-01 09:02:57 UTC) #11
commit-bot: I haz the power
Try jobs failed on following builders: win_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/win_blink_rel/builds/25065)
6 years, 3 months ago (2014-09-01 09:10:31 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/haraken@chromium.org/509933002/20001
6 years, 3 months ago (2014-09-01 09:21:15 UTC) #15
commit-bot: I haz the power
Failed to apply patch for Source/modules/mediastream/RTCStatsRequestImpl.h: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file ...
6 years, 3 months ago (2014-09-01 09:21:33 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/haraken@chromium.org/509933002/40001
6 years, 3 months ago (2014-09-01 10:34:15 UTC) #19
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_blink_dbg on tryserver.blink ...
6 years, 3 months ago (2014-09-01 11:42:48 UTC) #20
commit-bot: I haz the power
Try jobs failed on following builders: mac_gpu on tryserver.chromium.gpu (http://build.chromium.org/p/tryserver.chromium.gpu/builders/mac_gpu/builds/48783)
6 years, 3 months ago (2014-09-01 11:51:04 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/haraken@chromium.org/509933002/40001
6 years, 3 months ago (2014-09-01 11:52:27 UTC) #24
commit-bot: I haz the power
Failed to apply patch for Source/modules/mediastream/RTCStatsRequestImpl.h: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file ...
6 years, 3 months ago (2014-09-01 11:52:53 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/haraken@chromium.org/509933002/60001
6 years, 3 months ago (2014-09-01 12:23:36 UTC) #28
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_blink_dbg on tryserver.blink ...
6 years, 3 months ago (2014-09-01 13:42:19 UTC) #29
commit-bot: I haz the power
Try jobs failed on following builders: mac_gpu on tryserver.chromium.gpu (http://build.chromium.org/p/tryserver.chromium.gpu/builders/mac_gpu/builds/48804)
6 years, 3 months ago (2014-09-01 13:53:04 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/haraken@chromium.org/509933002/80001
6 years, 3 months ago (2014-09-02 00:50:54 UTC) #33
commit-bot: I haz the power
Committed patchset #5 (id:80001) as 181204
6 years, 3 months ago (2014-09-02 01:52:44 UTC) #34
tkent
A revert of this CL (patchset #5 id:80001) has been created in https://codereview.chromium.org/534473002/ by tkent@chromium.org. ...
6 years, 3 months ago (2014-09-02 02:32:48 UTC) #35
haraken
6 years, 3 months ago (2014-09-04 11:27:51 UTC) #36
Message was sent while issue was closed.
Now I understand why this crashes several tests in content_unittests.

The first problem is that the unittest needs to explicitly call
Heap::collectGarbage to test what it wants to test. For that goal, we need to
expose Heap::collectGarbage to the web layer. This is just work. I'll do that.

https://codereview.chromium.org/509933002/diff/100001/Source/platform/mediast...
File Source/platform/mediastream/MediaStreamComponent.cpp (right):

https://codereview.chromium.org/509933002/diff/100001/Source/platform/mediast...
Source/platform/mediastream/MediaStreamComponent.cpp:53: class
MediaStreamComponentDisposer {

We need to implement the disposer not only for MediaStreamComponent but also for
all platform objects that hold OwnPtr<ExtraData>s, because we have to assume
that the ExtraData's destructor can touch on-heap objects in the embedder side.

It's not nice to add the disposer for each class, we need to implement some
abstract class for the disposer.

https://codereview.chromium.org/509933002/diff/100001/Source/platform/mediast...
File Source/platform/mediastream/MediaStreamComponent.h (right):

https://codereview.chromium.org/509933002/diff/100001/Source/platform/mediast...
Source/platform/mediastream/MediaStreamComponent.h:109: OwnPtr<ExtraData>
m_extraData;

The second problem is this OwnPtr. If we explicitly call Heap::collectGarbage()
from media_stream_impl_unittest, it crashes for the following reason:

- Heap::collectGarbage() destructs MediaStreamSource and MediaStreamComponent.

- MediaStreamComponent's destructor destructs the OwnPtr<ExtraData>.

- Since the ExtraData is inherited in the embedder side, whatever can happen in
the ExtraData's destructor. In this particular case, the ExtraData's destructor
touches the MediaStreamSource that dies in the same GC round, and crashes.

To address the issue, we need to delay the destruction of OwnPtr<ExtraData> to
the thread-specific weak processing. I implemented the logic in
MediaStreamComponent.cpp.

Powered by Google App Engine
This is Rietveld 408576698