Bug 1055408 - Kill GMP timers when entering shutdown. r=jesup
authorChris Pearce <cpearce@mozilla.com>
Tue, 19 Aug 2014 20:56:55 +1200
changeset 200246 198c0704bacc6e8ac6954d43ef4900f53e8c504f
parent 200245 f636d9bdb619130a7d41586874cbc3e2ac43f475
child 200247 8addf953e8ebfdbb6adba1fa18803e5c5fb3ae81
push id47851
push usercpearce@mozilla.com
push dateTue, 19 Aug 2014 08:57:11 +0000
treeherdermozilla-inbound@198c0704bacc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1055408
milestone34.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 1055408 - Kill GMP timers when entering shutdown. r=jesup
content/media/gmp/GMPParent.cpp
--- a/content/media/gmp/GMPParent.cpp
+++ b/content/media/gmp/GMPParent.cpp
@@ -156,16 +156,22 @@ GMPParent::CloseIfUnused()
 
   if ((mDeleteProcessOnlyOnUnload ||
        mState == GMPStateLoaded ||
        mState == GMPStateUnloading) &&
       mVideoDecoders.IsEmpty() &&
       mVideoEncoders.IsEmpty() &&
       mDecryptors.IsEmpty() &&
       mAudioDecoders.IsEmpty()) {
+
+    // Ensure all timers are killed.
+    for (uint32_t i = mTimers.Length(); i > 0; i--) {
+      mTimers[i - 1]->Shutdown();
+    }
+
     if (mAsyncShutdownRequired) {
       if (!mAsyncShutdownInProgress) {
         LOGD(("%s::%s: %p sending async shutdown notification", __CLASS__,
               __FUNCTION__, this));
         mAsyncShutdownInProgress = true;
         if (!SendBeginAsyncShutdown()) {
           AbortAsyncShutdown();
         }
@@ -229,19 +235,18 @@ GMPParent::CloseActive(bool aDieWhenUnlo
   for (uint32_t i = mDecryptors.Length(); i > 0; i--) {
     mDecryptors[i - 1]->Shutdown();
   }
 
   for (uint32_t i = mAudioDecoders.Length(); i > 0; i--) {
     mAudioDecoders[i - 1]->Shutdown();
   }
 
-  for (uint32_t i = mTimers.Length(); i > 0; i--) {
-    mTimers[i - 1]->Shutdown();
-  }
+  // Note: we don't shutdown timers here, we do that in CloseIfUnused(),
+  // as there are multiple entry points to CloseIfUnused().
 
   // Note: We don't shutdown storage API objects here, as they need to
   // work during async shutdown of GMPs.
 
   // Note: the shutdown of the codecs is async!  don't kill
   // the plugin-container until they're all safely shut down via
   // CloseIfUnused();
   CloseIfUnused();