Bug 1287350. Part 2 - Call WatchManager::Shutdown() to prevent notifications from watchables. r=jya
authorJW Wang <jwwang@mozilla.com>
Fri, 15 Jul 2016 15:44:02 +0800
changeset 305472 5d68d9dba65807669ed2b3c5175facfc573145af
parent 305471 42a9d72c1c08522dd06a3e40492154539455d2fb
child 305473 f1988e4c59d12690a17b5962afa0bf374ee40b5d
push id30676
push userjwwang@mozilla.com
push dateTue, 19 Jul 2016 06:00:51 +0000
treeherderautoland@5d68d9dba658 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1287350
milestone50.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 1287350. Part 2 - Call WatchManager::Shutdown() to prevent notifications from watchables. r=jya MozReview-Commit-ID: 79GojLNE4Gn
dom/media/MediaDecoder.cpp
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -621,16 +621,19 @@ MediaDecoder::Shutdown()
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mShuttingDown) {
     return;
   }
 
   mShuttingDown = true;
 
+  // Unwatch all watch targets to prevent further notifications.
+  mWatchManager.Shutdown();
+
   mResourceCallback->Disconnect();
 
 #ifdef MOZ_EME
   mCDMProxyPromiseHolder.RejectIfExists(true, __func__);
 #endif
 
   // This changes the decoder state to SHUTDOWN and does other things
   // necessary to unblock the state machine thread if it's blocked, so
@@ -638,18 +641,16 @@ MediaDecoder::Shutdown()
   if (mDecoderStateMachine) {
     mTimedMetadataListener.Disconnect();
     mMetadataLoadedListener.Disconnect();
     mFirstFrameLoadedListener.Disconnect();
     mOnPlaybackEvent.Disconnect();
     mOnSeekingStart.Disconnect();
     mOnMediaNotSeekable.Disconnect();
 
-    mWatchManager.Unwatch(mIsAudioDataAudible, &MediaDecoder::NotifyAudibleStateChanged);
-
     mDecoderStateMachine->BeginShutdown()
       ->Then(AbstractThread::MainThread(), __func__, this,
              &MediaDecoder::FinishShutdown,
              &MediaDecoder::FinishShutdown);
   } else {
     // Ensure we always unregister asynchronously in order not to disrupt
     // the hashtable iterating in MediaShutdownManager::Shutdown().
     RefPtr<MediaDecoder> self = this;