Bug 1335895 - part 2: Update remote and in-process compositor sessions to destroy UiCompositorControllerChild on Android r=dvander draft
authorRandall Barker <rbarker@mozilla.com>
Wed, 05 Apr 2017 15:48:57 -0700
changeset 563836 5d2d4f9f888e9f63ce37a410207d09908e2a952d
parent 563835 52d2561d22ca8ab7bfbb2340f79e15dafbd5d4c3
child 563837 ecc78573bfb3005c58122f23926709e91fcc1c27
push id54439
push userbmo:rbarker@mozilla.com
push dateMon, 17 Apr 2017 22:56:51 +0000
reviewersdvander
bugs1335895
milestone55.0a1
Bug 1335895 - part 2: Update remote and in-process compositor sessions to destroy UiCompositorControllerChild on Android r=dvander
gfx/ipc/InProcessCompositorSession.cpp
gfx/ipc/RemoteCompositorSession.cpp
--- a/gfx/ipc/InProcessCompositorSession.cpp
+++ b/gfx/ipc/InProcessCompositorSession.cpp
@@ -75,12 +75,18 @@ InProcessCompositorSession::Shutdown()
   // Destroy will synchronously wait for the parent to acknowledge shutdown,
   // at which point CBP will defer a Release on the compositor thread. We
   // can safely release our reference now, and let the destructor run on either
   // thread.
   mCompositorBridgeChild->Destroy();
   mCompositorBridgeChild = nullptr;
   mCompositorBridgeParent = nullptr;
   mCompositorWidget = nullptr;
+#if defined(MOZ_WIDGET_ANDROID)
+  if (mUiCompositorControllerChild) {
+    mUiCompositorControllerChild->Destroy();
+    mUiCompositorControllerChild = nullptr;
+  }
+#endif //defined(MOZ_WIDGET_ANDROID)
 }
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/ipc/RemoteCompositorSession.cpp
+++ b/gfx/ipc/RemoteCompositorSession.cpp
@@ -5,16 +5,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "RemoteCompositorSession.h"
 #include "mozilla/VsyncDispatcher.h"
 #include "mozilla/layers/APZChild.h"
 #include "mozilla/layers/APZCTreeManagerChild.h"
 #include "mozilla/Unused.h"
 #include "nsBaseWidget.h"
+#if defined(MOZ_WIDGET_ANDROID)
+#include "mozilla/layers/UiCompositorControllerChild.h"
+#endif // defined(MOZ_WIDGET_ANDROID)
 
 namespace mozilla {
 namespace layers {
 
 using namespace gfx;
 using namespace widget;
 
 RemoteCompositorSession::RemoteCompositorSession(nsBaseWidget* aWidget,
@@ -31,16 +34,19 @@ RemoteCompositorSession::RemoteComposito
     mAPZ->SetCompositorSession(this);
   }
 }
 
 RemoteCompositorSession::~RemoteCompositorSession()
 {
   // This should have been shutdown first.
   MOZ_ASSERT(!mCompositorBridgeChild);
+#if defined(MOZ_WIDGET_ANDROID)
+  MOZ_ASSERT(!mUiCompositorControllerChild);
+#endif //defined(MOZ_WIDGET_ANDROID)
 }
 
 void
 RemoteCompositorSession::NotifyDeviceReset(uint64_t aSeqNo)
 {
   MOZ_ASSERT(mWidget);
   mWidget->OnRenderingDeviceReset(aSeqNo);
 }
@@ -102,13 +108,19 @@ RemoteCompositorSession::Shutdown()
   mContentController = nullptr;
   if (mAPZ) {
     mAPZ->SetCompositorSession(nullptr);
   }
   mCompositorBridgeChild->Destroy();
   mCompositorBridgeChild = nullptr;
   mCompositorWidgetDelegate = nullptr;
   mWidget = nullptr;
+#if defined(MOZ_WIDGET_ANDROID)
+  if (mUiCompositorControllerChild) {
+    mUiCompositorControllerChild->Destroy();
+    mUiCompositorControllerChild = nullptr;
+  }
+#endif //defined(MOZ_WIDGET_ANDROID)
   GPUProcessManager::Get()->UnregisterSession(this);
 }
 
 } // namespace layers
 } // namespace mozilla