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

Issue 1671033002: Do not let go of MediaStreamTracks too early. (Closed)

Created:
4 years, 10 months ago by sof
Modified:
4 years, 10 months ago
CC:
chromium-reviews, blink-reviews, tommyw+watchlist_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Do not let go of MediaStreamTracks too early. Add missing hasPendingActivity() predicate. R=haraken BUG=583264 Committed: https://crrev.com/6c27a5cbd705e2d052efbb2acd50af30b0557f01 Cr-Commit-Position: refs/heads/master@{#373864}

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+34 lines, -1 line) Patch
A third_party/WebKit/LayoutTests/fast/mediastream/MediaStreamTrack-gc-no-crash.html View 1 chunk +27 lines, -0 lines 0 comments Download
A + third_party/WebKit/LayoutTests/fast/mediastream/MediaStreamTrack-gc-no-crash-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp View 1 chunk +5 lines, -0 lines 3 comments Download

Messages

Total messages: 21 (5 generated)
sof
please take a look.
4 years, 10 months ago (2016-02-05 15:09:13 UTC) #2
haraken
LGTM
4 years, 10 months ago (2016-02-05 15:20:48 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1671033002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1671033002/1
4 years, 10 months ago (2016-02-05 18:59:58 UTC) #6
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years, 10 months ago (2016-02-05 19:07:31 UTC) #8
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/6c27a5cbd705e2d052efbb2acd50af30b0557f01 Cr-Commit-Position: refs/heads/master@{#373864}
4 years, 10 months ago (2016-02-05 19:08:25 UTC) #10
tommi (sloooow) - chröme
lgtm
4 years, 10 months ago (2016-02-05 21:46:21 UTC) #11
sof
https://codereview.chromium.org/1671033002/diff/1/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp File third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp (right): https://codereview.chromium.org/1671033002/diff/1/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp#newcode215 third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp:215: return !m_stopped && hasEventListeners(); I wonder if something effectively ...
4 years, 10 months ago (2016-02-07 06:54:27 UTC) #12
sof
https://codereview.chromium.org/1671033002/diff/1/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp File third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp (right): https://codereview.chromium.org/1671033002/diff/1/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp#newcode215 third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp:215: return !m_stopped && hasEventListeners(); On 2016/02/07 06:54:27, sof wrote: ...
4 years, 10 months ago (2016-02-07 07:04:36 UTC) #13
haraken
https://codereview.chromium.org/1671033002/diff/1/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp File third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp (right): https://codereview.chromium.org/1671033002/diff/1/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp#newcode215 third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp:215: return !m_stopped && hasEventListeners(); On 2016/02/07 07:04:36, sof wrote: ...
4 years, 10 months ago (2016-02-07 07:21:31 UTC) #14
haraken
On 2016/02/07 07:21:31, haraken wrote: > https://codereview.chromium.org/1671033002/diff/1/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp > File third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp (right): > > https://codereview.chromium.org/1671033002/diff/1/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp#newcode215 > ...
4 years, 10 months ago (2016-02-07 07:22:50 UTC) #15
sof
On 2016/02/07 07:22:50, haraken wrote: > On 2016/02/07 07:21:31, haraken wrote: > > > https://codereview.chromium.org/1671033002/diff/1/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp ...
4 years, 10 months ago (2016-02-07 07:53:52 UTC) #16
sof
On 2016/02/07 07:53:52, sof wrote: > On 2016/02/07 07:22:50, haraken wrote: > > On 2016/02/07 ...
4 years, 10 months ago (2016-02-07 08:03:26 UTC) #17
sof
On 2016/02/07 08:03:26, sof wrote: > On 2016/02/07 07:53:52, sof wrote: > > On 2016/02/07 ...
4 years, 10 months ago (2016-02-07 08:50:00 UTC) #18
sof
On 2016/02/07 08:50:00, sof wrote: > ... > > (No minor GC involved for the ...
4 years, 10 months ago (2016-02-07 15:38:30 UTC) #19
sof
The assert in https://codereview.chromium.org/1673073003/ would have caught out the problem here.
4 years, 10 months ago (2016-02-07 21:09:10 UTC) #20
haraken
4 years, 10 months ago (2016-02-07 23:56:29 UTC) #21
Message was sent while issue was closed.
On 2016/02/07 08:50:00, sof wrote:
> On 2016/02/07 08:03:26, sof wrote:
> > On 2016/02/07 07:53:52, sof wrote:
> > > On 2016/02/07 07:22:50, haraken wrote:
> > > > On 2016/02/07 07:21:31, haraken wrote:
> > > > >
> > > >
> > >
> >
>
https://codereview.chromium.org/1671033002/diff/1/third_party/WebKit/Source/m...
> > > > > File
third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
> > > > (right):
> > > > > 
> > > > >
> > > >
> > >
> >
>
https://codereview.chromium.org/1671033002/diff/1/third_party/WebKit/Source/m...
> > > > >
third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp:215:
> > > return
> > > > > !m_stopped && hasEventListeners();
> > > > > On 2016/02/07 07:04:36, sof wrote:
> > > > > > On 2016/02/07 06:54:27, sof wrote:
> > > > > > > I wonder if something effectively like this needs to be done for
all
> > > > > > > ActiveDOMObjects? It isn't done for several.
> > > > > > 
> > > > > > I notice MajorGCWrapperVisitor has special handling for Nodes with
> event
> > > > > > listeners, but not ActiveDOMObjects.
> > > > > 
> > > > > Yeah, without having the check, we'll end up with keeping
> ActiveDOMObjects
> > > > alive
> > > > > longer than needed. So we should.
> > > > 
> > > > Sorry, I'm confused. Without having the check, we end up with collecting
> the
> > > > ActiveDOMObjects too early, right? (That is problematic.)
> > > 
> > > Yes, I was confused too :) That's a separate issue, (not) creating an
> implicit
> > > dependency to the listener wrappers.
> > 
> > Let's recap..to enumerate the two issues:
> >  
> >  - should there be implicit references set up from the ActiveDOMObject
wrapper
> > to its listener wrappers.
> >  - if hasPendingActivity() returns false if it has event listeners, we end
up
> > GCing the ActiveDOMObject, but the wrapper isn't GCed. Next GC will then
fail.
> > 
> > I think they are independent issues. But solving the 2nd like was done here,
> > looks questionable now.
> 
> And a third issue is if hasPendingActivity() doesn't always return true if
> hasEventListeners() holds, then is it safe for MinorGCUnmodifiedWrapperVisitor
> not to check for that directly, like what is done for Nodes.
> 
> (No minor GC involved for the testcase here, but I need to study its GC
behavior
> more regardless.)

I'm still confused :)

> >  - should there be implicit references set up from the ActiveDOMObject
wrapper
> > to its listener wrappers.

I think the answer is yes. If the ActiveDOMObject wrapper doesn't have an
implicit reference to its listener wrappers, you end up with collecting the
listener wrappers prematurely.

> >  - if hasPendingActivity() returns false if it has event listeners, we end
up
> > GCing the ActiveDOMObject, but the wrapper isn't GCed. Next GC will then
fail.

I don't quite understand this. The ActiveDOMObject wrapper has an Oilpan's
persistent handle to the ActiveDOMObject. So the ActiveDOMObject should not be
collected by Oilpan's GC until the wrapper is collected by V8's GC.

> And a third issue is if hasPendingActivity() doesn't always return true if
> hasEventListeners() holds, then is it safe for MinorGCUnmodifiedWrapperVisitor
> not to check for that directly, like what is done for Nodes.

This is working because the current minor GC simply ignores all wrappers of
non-Nodes (i.e., the current minor GC cannot collect wrappers of non-Nodes).

https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit...

Powered by Google App Engine
This is Rietveld 408576698