Bug 1449567 - Don't reattach compositor for the same compositor object; r=snorp
☠☠ backed out by 300d0f16cf6f ☠ ☠
authorJim Chen <nchen@mozilla.com>
Thu, 13 Sep 2018 16:25:26 +0000
changeset 436613 52573727971b
parent 436612 27f227c43b5c
child 436614 300d0f16cf6f
push id34650
push usernerli@mozilla.com
push date2018-09-16 09:49 +0000
treeherdermozilla-central@300d0f16cf6f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1449567
milestone64.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
Bug 1449567 - Don't reattach compositor for the same compositor object; r=snorp If we're trying to detach and reattach the same compositor object for whatever reason, we should skip it so we don't inadvertently end up not attaching the object at all. Differential Revision: https://phabricator.services.mozilla.com/D5608
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerSession.java
widget/android/nsWindow.cpp
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerSession.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerSession.java
@@ -71,17 +71,17 @@ public class LayerSession {
             // Clear out any pending calls on the UI thread.
             LayerSession.this.onCompositorDetached();
             disposeNative();
         }
 
         @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
         @Override protected native void disposeNative();
 
-        @WrapForJNI(calledFrom = "any", dispatchTo = "gecko")
+        @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
         public native void attachNPZC(PanZoomController npzc);
 
         @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
         public native void onBoundsChanged(int left, int top, int width, int height);
 
         // Gecko thread pauses compositor; blocks UI thread.
         @WrapForJNI(calledFrom = "ui", dispatchTo = "current")
         public native void syncPauseCompositor();
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1234,23 +1234,26 @@ nsWindow::GeckoViewSupport::Transfer(con
                                      jni::Object::Param aDispatcher,
                                      jni::Object::Param aInitData)
 {
     if (window.mNPZCSupport) {
         MOZ_ASSERT(window.mLayerViewSupport);
         window.mNPZCSupport.Detach();
     }
 
-    if (window.mLayerViewSupport) {
+    if (window.mLayerViewSupport &&
+            window.mLayerViewSupport->GetJavaCompositor() != aCompositor) {
         window.mLayerViewSupport.Detach();
     }
 
     auto compositor = LayerSession::Compositor::LocalRef(
             inst.Env(), LayerSession::Compositor::Ref::From(aCompositor));
-    window.mLayerViewSupport.Attach(compositor, &window, compositor);
+    if (!window.mLayerViewSupport) {
+        window.mLayerViewSupport.Attach(compositor, &window, compositor);
+    }
 
     MOZ_ASSERT(window.mAndroidView);
     window.mAndroidView->mEventDispatcher->Attach(
             java::EventDispatcher::Ref::From(aDispatcher), mDOMWindow);
 
     if (mIsReady) {
         // We're in a transfer; update init-data and notify JS code.
         window.mAndroidView->mInitData =