Merge inbound to mozilla-central. a=merge
authorBogdan Tara <btara@mozilla.com>
Tue, 18 Jun 2019 07:10:14 +0300
changeset 479096 9b4c8fb46d850db196b0ed6aad0a35b85b178745
parent 479094 e593e11eff08e99f021de466e68964ca136cd62f (current diff)
parent 479095 adc12b4c5a9d8f5139d182441f7fe2b672f08677 (diff)
child 479098 30e6693ef586c18a1c067cb361cbe9ce97d56b6b
push id36167
push userbtara@mozilla.com
push dateTue, 18 Jun 2019 04:10:42 +0000
treeherdermozilla-central@9b4c8fb46d85 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone69.0a1
first release with
nightly linux32
9b4c8fb46d85 / 69.0a1 / 20190618041042 / files
nightly linux64
9b4c8fb46d85 / 69.0a1 / 20190618041042 / files
nightly mac
9b4c8fb46d85 / 69.0a1 / 20190618041042 / files
nightly win32
9b4c8fb46d85 / 69.0a1 / 20190618041042 / files
nightly win64
9b4c8fb46d85 / 69.0a1 / 20190618041042 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to mozilla-central. a=merge
--- a/gfx/layers/ipc/UiCompositorControllerChild.cpp
+++ b/gfx/layers/ipc/UiCompositorControllerChild.cpp
@@ -8,16 +8,17 @@
 
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/layers/CompositorThread.h"
 #include "mozilla/layers/UiCompositorControllerMessageTypes.h"
 #include "mozilla/layers/UiCompositorControllerParent.h"
 #include "mozilla/gfx/GPUProcessManager.h"
 #include "mozilla/StaticPtr.h"
 #include "nsBaseWidget.h"
+#include "nsProxyRelease.h"
 #include "nsThreadUtils.h"
 
 #if defined(MOZ_WIDGET_ANDROID)
 #  include "mozilla/widget/AndroidUiThread.h"
 
 static RefPtr<nsThread> GetUiThread() { return mozilla::GetAndroidUiThread(); }
 #else
 static RefPtr<nsThread> GetUiThread() {
@@ -179,17 +180,22 @@ void UiCompositorControllerChild::Destro
         NewRunnableMethod("layers::UiCompositorControllerChild::Destroy", this,
                           &UiCompositorControllerChild::Destroy),
         nsIThread::DISPATCH_SYNC);
     return;
   }
 
   if (mIsOpen) {
     // Close the underlying IPC channel.
-    mWidget = nullptr;
+
+    // Dispatch mWidget to main thread to prevent it from being destructed by
+    // the ui thread.
+    RefPtr<nsIWidget> widget = mWidget.forget();
+    NS_ReleaseOnMainThreadSystemGroup("UiCompositorControllerChild::mWidget",
+                                      widget.forget());
     PUiCompositorControllerChild::Close();
     mIsOpen = false;
   }
 }
 
 void UiCompositorControllerChild::SetBaseWidget(nsBaseWidget* aWidget) {
   mWidget = aWidget;
 }
--- a/gfx/layers/ipc/UiCompositorControllerChild.h
+++ b/gfx/layers/ipc/UiCompositorControllerChild.h
@@ -73,17 +73,17 @@ class UiCompositorControllerChild final
   void SendCachedValues();
 
   bool mIsOpen;
   uint64_t mProcessToken;
   Maybe<gfx::IntRect> mResize;
   Maybe<int32_t> mMaxToolbarHeight;
   Maybe<uint32_t> mDefaultClearColor;
   Maybe<bool> mLayerUpdateEnabled;
-  nsBaseWidget* mWidget;
+  RefPtr<nsBaseWidget> mWidget;
   // Should only be set when compositor is in process.
   RefPtr<UiCompositorControllerParent> mParent;
 };
 
 }  // namespace layers
 }  // namespace mozilla
 
 #endif  // include_gfx_ipc_UiCompositorControllerChild_h