Bug 1520975 - only bind RemoteDecoderManagerChild's IPC connection when needed. r=jya
authorMichael Froman <mfroman@mozilla.com>
Fri, 18 Jan 2019 03:53:51 +0000
changeset 454466 edc879d89731b3ce0d849af3d78b60e7a6ce53a4
parent 454465 188f7a851811d58a97cffe44ec52df4ef5b2993b
child 454467 a69c1a1dc6fe4dec9598bcdd3038d12bf681a045
push id35397
push useropoprus@mozilla.com
push dateSat, 19 Jan 2019 03:35:41 +0000
treeherdermozilla-central@57dc8bbbc38f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1520975
milestone66.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 1520975 - only bind RemoteDecoderManagerChild's IPC connection when needed. r=jya Differential Revision: https://phabricator.services.mozilla.com/D16925
dom/media/ipc/RemoteDecoderManagerChild.cpp
--- a/dom/media/ipc/RemoteDecoderManagerChild.cpp
+++ b/dom/media/ipc/RemoteDecoderManagerChild.cpp
@@ -89,16 +89,26 @@ bool RemoteDecoderManagerChild::DeallocP
     PRemoteVideoDecoderChild* actor) {
   RemoteVideoDecoderChild* child = static_cast<RemoteVideoDecoderChild*>(actor);
   child->IPDLActorDestroyed();
   return true;
 }
 
 void RemoteDecoderManagerChild::Open(
     Endpoint<PRemoteDecoderManagerChild>&& aEndpoint) {
+  MOZ_ASSERT(NS_GetCurrentThread() == GetManagerThread());
+  // Only create RemoteDecoderManagerChild, bind new endpoint and init
+  // ipdl if:
+  // 1) haven't init'd sRemoteDecoderManagerChild
+  // or
+  // 2) if ActorDestroy was called (mCanSend is false) meaning the other
+  // end of the ipc channel was torn down
+  if (sRemoteDecoderManagerChild && sRemoteDecoderManagerChild->mCanSend) {
+    return;
+  }
   sRemoteDecoderManagerChild = nullptr;
   if (aEndpoint.IsValid()) {
     RefPtr<RemoteDecoderManagerChild> manager = new RemoteDecoderManagerChild();
     if (aEndpoint.Bind(manager)) {
       sRemoteDecoderManagerChild = manager;
       manager->InitIPDL();
     }
   }