Bug 1514253 - Create PanZoomController immediately in GeckoSession r=geckoview-reviewers,droeh#geckoview-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D14562

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Willcox 2019-01-17 14:17:50 +00:00
Родитель ac50ddf7b6
Коммит 269f751ce7
2 изменённых файлов: 11 добавлений и 13 удалений

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

@ -107,7 +107,7 @@ public class GeckoSession implements Parcelable {
private boolean mShouldPinOnScreen;
// All fields are accessed on UI thread only.
private PanZoomController mNPZC;
private PanZoomController mPanZoomController = new PanZoomController(this);
private OverscrollEdgeEffect mOverscroll;
private DynamicToolbarAnimator mToolbar;
private CompositorController mController;
@ -3658,13 +3658,7 @@ public class GeckoSession implements Parcelable {
public @NonNull PanZoomController getPanZoomController() {
ThreadUtils.assertOnUiThread();
if (mNPZC == null) {
mNPZC = new PanZoomController(this);
if (mAttachedCompositor) {
mCompositor.attachNPZC(mNPZC);
}
}
return mNPZC;
return mPanZoomController;
}
/**
@ -4340,10 +4334,7 @@ public class GeckoSession implements Parcelable {
}
mAttachedCompositor = true;
if (mNPZC != null) {
mCompositor.attachNPZC(mNPZC);
}
mCompositor.attachNPZC(mPanZoomController);
if (mSurface != null) {
// If we have a valid surface, create the compositor now that we're attached.

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

@ -890,7 +890,14 @@ class nsWindow::LayerViewSupport final
}
MOZ_ASSERT(aNPZC);
MOZ_ASSERT(!mWindow->mNPZCSupport);
// We can have this situation if we get two GeckoViewSupport::Transfer()
// called before the first AttachNPZC() gets here. Just detach the current
// instance since that's what happens in GeckoViewSupport::Transfer() as
// well.
if (mWindow->mNPZCSupport) {
mWindow->mNPZCSupport.Detach(mWindow->mNPZCSupport->GetJavaNPZC());
}
auto npzc = PanZoomController::LocalRef(
jni::GetGeckoThreadEnv(), PanZoomController::Ref::From(aNPZC));