Bug 1316215 - Make GMPParent::IsUsed() take into account whether there are pending GetContentParent calls. r=gerald draft
authorChris Pearce <cpearce@mozilla.com>
Fri, 18 Nov 2016 12:37:14 +1300
changeset 443256 8cc04d57ea1ef4e48c7ff088dbb12eabe4b3b223
parent 443255 59aa7bcfe8b8f44274d136d6147a946542a64fff
child 443257 6e6892a5e32a485b5bfc2f93bddb2d2fe5a422bd
push id36941
push usercpearce@mozilla.com
push dateThu, 24 Nov 2016 04:18:29 +0000
reviewersgerald
bugs1316215
milestone53.0a1
Bug 1316215 - Make GMPParent::IsUsed() take into account whether there are pending GetContentParent calls. r=gerald In a similar vein to the previous patch, while we're waiting on a GetContentParent promise to resolve, we don't want the GMPParent to shutdown. So make IsUsed() check whether we're waiting on a GetContentParent promise to resolve, so we don't pull the rug out from under any code waiting to get a content parent to bridge a GMP. MozReview-Commit-ID: 8cTCuXLXMsK
dom/media/gmp/GMPParent.h
--- a/dom/media/gmp/GMPParent.h
+++ b/dom/media/gmp/GMPParent.h
@@ -184,17 +184,18 @@ private:
   bool DeallocPGMPTimerParent(PGMPTimerParent* aActor) override;
 
   mozilla::ipc::IPCResult RecvAsyncShutdownComplete() override;
   mozilla::ipc::IPCResult RecvAsyncShutdownRequired() override;
 
   mozilla::ipc::IPCResult RecvPGMPContentChildDestroyed() override;
   bool IsUsed()
   {
-    return mGMPContentChildCount > 0;
+    return mGMPContentChildCount > 0 ||
+           !mGetContentParentPromises.IsEmpty();
   }
 
   void ResolveGetContentParentPromises();
   void RejectGetContentParentPromises();
 
   static void AbortWaitingForGMPAsyncShutdown(nsITimer* aTimer, void* aClosure);
   nsresult EnsureAsyncShutdownTimeoutSet();