Merge mozilla-central to autoland. a=merge CLOSED TREE
authorBogdan Tara <btara@mozilla.com>
Tue, 18 Jun 2019 07:13:04 +0300
changeset 479098 30e6693ef586c18a1c067cb361cbe9ce97d56b6b
parent 479097 a2a92e2fd645c26336792250400ff99d7c35fe2e (current diff)
parent 479096 9b4c8fb46d850db196b0ed6aad0a35b85b178745 (diff)
child 479099 f0d1b44ac7a9337d17fe7c89cf08adf9923a33a1
push id36168
push usercsabou@mozilla.com
push dateTue, 18 Jun 2019 15:56:50 +0000
treeherdermozilla-central@2af46ed2e59b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone69.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
Merge mozilla-central to autoland. a=merge CLOSED TREE
--- 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