Bug 1388309 P3 - pass the decodeVideoOnGPUProcess info through PContent actors; draft
authorKaku Kuo <kaku@mozilla.com>
Mon, 14 Aug 2017 17:50:03 +0800
changeset 646260 531ae3ddde108c7c1fbe809784113b00166bdf7b
parent 646259 ec886cd9ad807e0c63b616bd977753f3b5083a71
child 646261 546c8abe515b4fc887d355c165643862346aff78
push id74045
push userbmo:kaku@mozilla.com
push dateTue, 15 Aug 2017 02:31:44 +0000
bugs1388309
milestone57.0a1
Bug 1388309 P3 - pass the decodeVideoOnGPUProcess info through PContent actors; MozReview-Commit-ID: FSgAvIr2Coy
dom/ipc/ContentChild.cpp
dom/ipc/ContentChild.h
dom/ipc/ContentParent.cpp
dom/ipc/PContent.ipdl
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -1271,42 +1271,45 @@ ContentChild::RecvInitProcessHangMonitor
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvInitRendering(Endpoint<PCompositorManagerChild>&& aCompositor,
                                 Endpoint<PImageBridgeChild>&& aImageBridge,
                                 Endpoint<PVRManagerChild>&& aVRBridge,
                                 Endpoint<PVideoDecoderManagerChild>&& aVideoManager,
-                                nsTArray<uint32_t>&& namespaces)
+                                nsTArray<uint32_t>&& namespaces,
+                                const bool& aDecodeVideoOnGpuProcess)
 {
   MOZ_ASSERT(namespaces.Length() == 3);
 
   if (!CompositorManagerChild::Init(Move(aCompositor), namespaces[0])) {
     return IPC_FAIL_NO_REASON(this);
   }
   if (!CompositorManagerChild::CreateContentCompositorBridge(namespaces[1])) {
     return IPC_FAIL_NO_REASON(this);
   }
   if (!ImageBridgeChild::InitForContent(Move(aImageBridge), namespaces[2])) {
     return IPC_FAIL_NO_REASON(this);
   }
   if (!gfx::VRManagerChild::InitForContent(Move(aVRBridge))) {
     return IPC_FAIL_NO_REASON(this);
   }
-  VideoDecoderManagerChild::InitForContent(Move(aVideoManager));
+  VideoDecoderManagerChild::InitForContent(Move(aVideoManager),
+                                           aDecodeVideoOnGpuProcess);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvReinitRendering(Endpoint<PCompositorManagerChild>&& aCompositor,
                                   Endpoint<PImageBridgeChild>&& aImageBridge,
                                   Endpoint<PVRManagerChild>&& aVRBridge,
                                   Endpoint<PVideoDecoderManagerChild>&& aVideoManager,
-                                  nsTArray<uint32_t>&& namespaces)
+                                  nsTArray<uint32_t>&& namespaces,
+                                  const bool& aDecodeVideoOnGpuProcess)
 {
   MOZ_ASSERT(namespaces.Length() == 3);
   nsTArray<RefPtr<TabChild>> tabs = TabChild::GetAll();
 
   // Zap all the old layer managers we have lying around.
   for (const auto& tabChild : tabs) {
     if (tabChild->LayersId()) {
       tabChild->InvalidateLayers();
@@ -1330,17 +1333,18 @@ ContentChild::RecvReinitRendering(Endpoi
 
   // Establish new PLayerTransactions.
   for (const auto& tabChild : tabs) {
     if (tabChild->LayersId()) {
       tabChild->ReinitRendering();
     }
   }
 
-  VideoDecoderManagerChild::InitForContent(Move(aVideoManager));
+  VideoDecoderManagerChild::InitForContent(Move(aVideoManager),
+                                           aDecodeVideoOnGpuProcess);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvAudioDefaultDeviceChange()
 {
 #ifdef XP_WIN
   audio::AudioNotificationReceiver::NotifyDefaultDeviceChanged();
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -179,25 +179,27 @@ public:
   RecvInitProcessHangMonitor(Endpoint<PProcessHangMonitorChild>&& aHangMonitor) override;
 
   mozilla::ipc::IPCResult
   RecvInitRendering(
     Endpoint<PCompositorManagerChild>&& aCompositor,
     Endpoint<PImageBridgeChild>&& aImageBridge,
     Endpoint<PVRManagerChild>&& aVRBridge,
     Endpoint<PVideoDecoderManagerChild>&& aVideoManager,
-    nsTArray<uint32_t>&& namespaces) override;
+    nsTArray<uint32_t>&& namespaces,
+    const bool& aDecodeVideoOnGpuProcess) override;
 
   mozilla::ipc::IPCResult
   RecvReinitRendering(
     Endpoint<PCompositorManagerChild>&& aCompositor,
     Endpoint<PImageBridgeChild>&& aImageBridge,
     Endpoint<PVRManagerChild>&& aVRBridge,
     Endpoint<PVideoDecoderManagerChild>&& aVideoManager,
-    nsTArray<uint32_t>&& namespaces) override;
+    nsTArray<uint32_t>&& namespaces,
+    const bool& aDecodeVideoOnGpuProcess) override;
 
   virtual mozilla::ipc::IPCResult RecvAudioDefaultDeviceChange() override;
 
   mozilla::ipc::IPCResult RecvReinitRenderingForDeviceReset() override;
 
   virtual mozilla::ipc::IPCResult RecvSetProcessSandbox(const MaybeFileDesc& aBroker) override;
 
   virtual PBrowserChild* AllocPBrowserChild(const TabId& aTabId,
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2316,17 +2316,18 @@ ContentParent::InitInternal(ProcessPrior
         &namespaces);
       MOZ_ASSERT(opened);
 
       Unused << SendInitRendering(
         Move(compositor),
         Move(imageBridge),
         Move(vrBridge),
         Move(videoManager),
-        namespaces);
+        namespaces,
+        gpm->DecodeVideoOnGpuProcess());
 
       gpm->AddListener(this);
     }
   }
 
   nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
   if (sheetService) {
     // This looks like a lot of work, but in a normal browser session we just
@@ -2483,17 +2484,18 @@ ContentParent::OnCompositorUnexpectedShu
     &namespaces);
   MOZ_ASSERT(opened);
 
   Unused << SendReinitRendering(
     Move(compositor),
     Move(imageBridge),
     Move(vrBridge),
     Move(videoManager),
-    namespaces);
+    namespaces,
+    gpm->DecodeVideoOnGpuProcess());
 }
 
 void
 ContentParent::OnCompositorDeviceReset()
 {
   Unused << SendReinitRenderingForDeviceReset();
 }
 
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -344,27 +344,29 @@ child:
     async InitProfiler(Endpoint<PProfilerChild> aEndpoint);
 
     // Give the content process its endpoints to the compositor.
     async InitRendering(
       Endpoint<PCompositorManagerChild> compositor,
       Endpoint<PImageBridgeChild> imageBridge,
       Endpoint<PVRManagerChild> vr,
       Endpoint<PVideoDecoderManagerChild> video,
-      uint32_t[] namespaces);
+      uint32_t[] namespaces,
+      bool decodeVideoOnGpuProcess);
 
     // Re-create the rendering stack using the given endpoints. This is sent
     // after the compositor process has crashed. The new endpoints may be to a
     // newly launched GPU process, or the compositor thread of the UI process.
     async ReinitRendering(
       Endpoint<PCompositorManagerChild> compositor,
       Endpoint<PImageBridgeChild> bridge,
       Endpoint<PVRManagerChild> vr,
       Endpoint<PVideoDecoderManagerChild> video,
-      uint32_t[] namespaces);
+      uint32_t[] namespaces,
+      bool decodeVideoOnGpuProcess);
 
     async AudioDefaultDeviceChange();
 
     // Re-create the rendering stack for a device reset.
     async ReinitRenderingForDeviceReset();
 
     /**
      * Enable system-level sandboxing features, if available.  Can