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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jim Chen 2018-09-13 16:25:26 +00:00
Родитель 5e7929410f
Коммит 5055667930
2 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -76,7 +76,7 @@ public class LayerSession {
@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")

Просмотреть файл

@ -1239,13 +1239,16 @@ nsWindow::GeckoViewSupport::Transfer(const GeckoSession::Window::LocalRef& inst,
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(