| Index: third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
|
| diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
|
| index 2dbab3b640342811d0596e906da702aa77ea7db5..68bffa34dd684a47015ed787f1aea43f14f37dbb 100644
|
| --- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
|
| +++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
|
| @@ -212,7 +212,19 @@ void MediaStreamTrack::stop()
|
|
|
| bool MediaStreamTrack::hasPendingActivity() const
|
| {
|
| - return !m_stopped && hasEventListeners();
|
| + // If 'ended' listeners exist and the object hasn't yet reached
|
| + // that state, keep the object alive.
|
| + //
|
| + // An otherwise unreachable MediaStreamTrack object in an non-ended
|
| + // state will otherwise indirectly be transitioned to the 'ended' state
|
| + // while finalizing m_component. Which dispatches an 'ended' event,
|
| + // referring to this object as the target. If this object is then GCed
|
| + // at the same time, v8 objects will retain (wrapper) references to
|
| + // this dead MediaStreamTrack object. Bad.
|
| + //
|
| + // Hence insisting on keeping this object alive until the 'ended'
|
| + // state has been reached & handled.
|
| + return !ended() && hasEventListeners(EventTypeNames::ended);
|
| }
|
|
|
| PassOwnPtr<AudioSourceProvider> MediaStreamTrack::createWebAudioSource()
|
|
|