Bug 1071482 - Break a cycle in TrackBuffer and SourceBufferDecoder's MediaTaskQueue's SharedThreadPool. r=cajbir
authorChris Pearce <cpearce@mozilla.com>
Tue, 28 Oct 2014 13:21:13 +1300
changeset 237368 8839a3db64216f6ee1853649ee47d1c53a4d4a77
parent 237367 971beced9390898a5cad30a5b963d4565435f1f6
child 237369 e72c87749c0f0bf5b005844e0bc23641d02c9e1b
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscajbir
bugs1071482
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1071482 - Break a cycle in TrackBuffer and SourceBufferDecoder's MediaTaskQueue's SharedThreadPool. r=cajbir
dom/media/mediasource/SourceBufferDecoder.h
dom/media/mediasource/TrackBuffer.cpp
--- a/dom/media/mediasource/SourceBufferDecoder.h
+++ b/dom/media/mediasource/SourceBufferDecoder.h
@@ -79,16 +79,28 @@ public:
   }
 
   void SetTaskQueue(MediaTaskQueue* aTaskQueue)
   {
     MOZ_ASSERT((!mTaskQueue && aTaskQueue) || (mTaskQueue && !aTaskQueue));
     mTaskQueue = aTaskQueue;
   }
 
+  void BreakCycles()
+  {
+    if (mReader) {
+      mReader->BreakCycles();
+      mReader = nullptr;
+    }
+    mTaskQueue = nullptr;
+#ifdef MOZ_EME
+    mCDMProxy = nullptr;
+#endif
+  }
+
 #ifdef MOZ_EME
   virtual nsresult SetCDMProxy(CDMProxy* aProxy)
   {
     MOZ_ASSERT(NS_IsMainThread());
     ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
     mCDMProxy = aProxy;
     return NS_OK;
   }
--- a/dom/media/mediasource/TrackBuffer.cpp
+++ b/dom/media/mediasource/TrackBuffer.cpp
@@ -386,17 +386,17 @@ TrackBuffer::ContainsTime(int64_t aTime)
 }
 
 void
 TrackBuffer::BreakCycles()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   for (uint32_t i = 0; i < mDecoders.Length(); ++i) {
-    mDecoders[i]->GetReader()->BreakCycles();
+    mDecoders[i]->BreakCycles();
   }
   mDecoders.Clear();
 
   // These are cleared in Shutdown()
   MOZ_ASSERT(mInitializedDecoders.IsEmpty());
   MOZ_ASSERT(!mParentDecoder);
 }