diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index 0de9f3c8cf3f..7cb707791ceb 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -62,7 +62,6 @@ GMPParent::GMPParent() , mAbnormalShutdownInProgress(false) , mAsyncShutdownRequired(false) , mAsyncShutdownInProgress(false) - , mHasAccessedStorage(false) { } @@ -697,12 +696,6 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy) } } -bool -GMPParent::HasAccessedStorage() const -{ - return mHasAccessedStorage; -} - mozilla::dom::PCrashReporterParent* GMPParent::AllocPCrashReporterParent(const NativeThreadId& aThread) { @@ -809,7 +802,6 @@ GMPParent::RecvPGMPStorageConstructor(PGMPStorageParent* aActor) if (NS_WARN_IF(NS_FAILED(p->Init()))) { return false; } - mHasAccessedStorage = true; return true; } diff --git a/dom/media/gmp/GMPParent.h b/dom/media/gmp/GMPParent.h index 346f026fc1e6..14b8c2cec136 100644 --- a/dom/media/gmp/GMPParent.h +++ b/dom/media/gmp/GMPParent.h @@ -113,6 +113,7 @@ public: // Specifies that a GMP can only work with the specified NodeIds. void SetNodeId(const nsACString& aNodeId); + const nsACString& GetNodeId() const { return mNodeId; } // Returns true if a plugin can be or is being used across multiple NodeIds. bool CanBeSharedCrossNodeIds() const; @@ -131,8 +132,6 @@ public: void AbortAsyncShutdown(); - bool HasAccessedStorage() const; - private: ~GMPParent(); nsRefPtr mService; @@ -197,7 +196,6 @@ private: bool mAsyncShutdownRequired; bool mAsyncShutdownInProgress; - bool mHasAccessedStorage; }; } // namespace gmp diff --git a/dom/media/gmp/GMPService.cpp b/dom/media/gmp/GMPService.cpp index 54c16c77f6d9..baaab2232ba5 100644 --- a/dom/media/gmp/GMPService.cpp +++ b/dom/media/gmp/GMPService.cpp @@ -1256,11 +1256,9 @@ GeckoMediaPluginService::ClearStorage() return; #endif - // Shutdown plugins that have touched storage, as they could have - // state that depends on storage. We don't want them to write data - // after we've cleared storage, as they could end up in an inconsistent - // state, so we must ensure they're shutdown before we actually clear - // storage. Note: we can't shut them down while holding the lock, + // Shutdown all plugins that have valid node IDs as those IDs will become + // invalid and shouldn't be used anymore after we clear storage data. + // Note: we can't shut them down while holding the lock, // as the lock is not re-entrant and shutdown requires taking the lock. // The plugin list is only edited on the GMP thread, so this should be OK. nsTArray> pluginsToKill; @@ -1268,7 +1266,7 @@ GeckoMediaPluginService::ClearStorage() MutexAutoLock lock(mMutex); for (size_t i = 0; i < mPlugins.Length(); i++) { nsRefPtr parent(mPlugins[i]); - if (parent->HasAccessedStorage()) { + if (!parent->GetNodeId().IsEmpty()) { pluginsToKill.AppendElement(parent); } }