Bug 1555076 - avoid a potential timeout race on Windows RDD launch. r=jld, a=jcristau
authorMichael Froman <mfroman@mozilla.com>
Mon, 10 Jun 2019 15:03:46 +0000
changeset 537054 2a84ae0921d1b955b2f229b16ec84ca0937ceb0e
parent 537053 10c593d29a314dd5440f0b17b0b031a71baf20d1
child 537055 b632ea1ae36e49a6ab60ed2b34ee2e967dcb26d9
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjld, jcristau
bugs1555076
milestone68.0
Bug 1555076 - avoid a potential timeout race on Windows RDD launch. r=jld, a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D34186
dom/media/ipc/RDDProcessHost.cpp
--- a/dom/media/ipc/RDDProcessHost.cpp
+++ b/dom/media/ipc/RDDProcessHost.cpp
@@ -141,25 +141,30 @@ void RDDProcessHost::OnChannelErrorTask(
 
 static uint64_t sRDDProcessTokenCounter = 0;
 
 void RDDProcessHost::InitAfterConnect(bool aSucceeded) {
   MOZ_ASSERT(mLaunchPhase == LaunchPhase::Waiting);
   MOZ_ASSERT(!mRDDChild);
 
   mLaunchPhase = LaunchPhase::Complete;
-  mPrefSerializer = nullptr;
 
   if (aSucceeded) {
     mProcessToken = ++sRDDProcessTokenCounter;
     mRDDChild = MakeUnique<RDDChild>(this);
     DebugOnly<bool> rv =
         mRDDChild->Open(GetChannel(), base::GetProcId(GetChildProcessHandle()));
     MOZ_ASSERT(rv);
 
+    // Only clear mPrefSerializer in the success case to avoid a
+    // possible race in the case case of a timeout on Windows launch.
+    // See Bug 1555076 comment 7:
+    // https://bugzilla.mozilla.org/show_bug.cgi?id=1555076#c7
+    mPrefSerializer = nullptr;
+
     bool startMacSandbox = false;
 
 #if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
     // If the sandbox was started at launch time,
     // do not start the sandbox again.
     startMacSandbox = !sLaunchWithMacSandbox;
 #endif