зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1288467 - This patch removes GLController.java entirely, moving necessary functionality into LayerView and a new Compositor class. r=jchen
This commit is contained in:
Родитель
302ed5bcd2
Коммит
62350ea07f
|
@ -11,7 +11,6 @@ import org.json.JSONException;
|
|||
import org.json.JSONObject;
|
||||
import org.mozilla.gecko.annotation.ReflectionTarget;
|
||||
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||
import org.mozilla.gecko.gfx.GLController;
|
||||
import org.mozilla.gecko.gfx.LayerView;
|
||||
import org.mozilla.gecko.mozglue.JNIObject;
|
||||
import org.mozilla.gecko.util.EventCallback;
|
||||
|
@ -109,15 +108,13 @@ public class GeckoView extends LayerView
|
|||
|
||||
@WrapForJNI
|
||||
private static final class Window extends JNIObject {
|
||||
/* package */ final GLController glController = new GLController();
|
||||
|
||||
static native void open(Window instance, GeckoView view, GLController glController,
|
||||
static native void open(Window instance, GeckoView view, Compositor compositor,
|
||||
String chromeURI,
|
||||
int width, int height);
|
||||
|
||||
@Override protected native void disposeNative();
|
||||
native void close();
|
||||
native void reattach(GeckoView view);
|
||||
native void reattach(GeckoView view, Compositor compositor);
|
||||
native void loadUri(String uri, int flags);
|
||||
}
|
||||
|
||||
|
@ -229,25 +226,24 @@ public class GeckoView extends LayerView
|
|||
final String chromeURI = getGeckoInterface().getDefaultChromeURI();
|
||||
|
||||
if (GeckoThread.isStateAtLeast(GeckoThread.State.PROFILE_READY)) {
|
||||
Window.open(window, this, window.glController,
|
||||
Window.open(window, this, getCompositor(),
|
||||
chromeURI,
|
||||
metrics.widthPixels, metrics.heightPixels);
|
||||
} else {
|
||||
GeckoThread.queueNativeCallUntil(GeckoThread.State.PROFILE_READY, Window.class,
|
||||
"open", window, GeckoView.class, this, window.glController,
|
||||
"open", window, GeckoView.class, this, getCompositor(),
|
||||
String.class, chromeURI,
|
||||
metrics.widthPixels, metrics.heightPixels);
|
||||
}
|
||||
} else {
|
||||
if (GeckoThread.isStateAtLeast(GeckoThread.State.PROFILE_READY)) {
|
||||
window.reattach(this);
|
||||
window.reattach(this, getCompositor());
|
||||
} else {
|
||||
GeckoThread.queueNativeCallUntil(GeckoThread.State.PROFILE_READY,
|
||||
window, "reattach", GeckoView.class, this);
|
||||
window, "reattach", GeckoView.class, this, getCompositor());
|
||||
}
|
||||
}
|
||||
|
||||
setGLController(window.glController);
|
||||
super.onAttachedToWindow();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,183 +0,0 @@
|
|||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko.gfx;
|
||||
|
||||
import org.mozilla.gecko.AppConstants;
|
||||
import org.mozilla.gecko.GeckoAppShell;
|
||||
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||
import org.mozilla.gecko.mozglue.JNIObject;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* This class is a singleton that tracks EGL and compositor things over
|
||||
* the lifetime of Fennec running.
|
||||
* We only ever create one C++ compositor over Fennec's lifetime, but
|
||||
* most of the Java-side objects (e.g. LayerView, GeckoLayerClient,
|
||||
* LayerRenderer) can all get destroyed and re-created if the GeckoApp
|
||||
* activity is destroyed. This GLController is never destroyed, so that
|
||||
* the mCompositorCreated field and other state variables are always
|
||||
* accurate.
|
||||
*/
|
||||
public class GLController extends JNIObject {
|
||||
private static final String LOGTAG = "GeckoGLController";
|
||||
|
||||
/* package */ LayerView mView;
|
||||
private boolean mServerSurfaceValid;
|
||||
private int mWidth, mHeight;
|
||||
|
||||
/* This is written by the compositor thread (while the UI thread
|
||||
* is blocked on it) and read by the UI thread. */
|
||||
private volatile boolean mCompositorCreated;
|
||||
|
||||
@WrapForJNI @Override // JNIObject
|
||||
protected native void disposeNative();
|
||||
|
||||
// Gecko thread sets its Java instances; does not block UI thread.
|
||||
@WrapForJNI
|
||||
/* package */ native void attachToJava(GeckoLayerClient layerClient,
|
||||
NativePanZoomController npzc);
|
||||
|
||||
@WrapForJNI
|
||||
/* package */ native void onSizeChanged(int windowWidth, int windowHeight,
|
||||
int screenWidth, int screenHeight);
|
||||
|
||||
// Gecko thread creates compositor; blocks UI thread.
|
||||
@WrapForJNI
|
||||
private native void createCompositor(int width, int height);
|
||||
|
||||
// Gecko thread pauses compositor; blocks UI thread.
|
||||
@WrapForJNI
|
||||
private native void pauseCompositor();
|
||||
|
||||
// UI thread resumes compositor and notifies Gecko thread; does not block UI thread.
|
||||
@WrapForJNI
|
||||
private native void syncResumeResizeCompositor(int width, int height);
|
||||
|
||||
@WrapForJNI
|
||||
private native void syncInvalidateAndScheduleComposite();
|
||||
|
||||
public GLController() {
|
||||
}
|
||||
|
||||
void serverSurfaceDestroyed() {
|
||||
ThreadUtils.assertOnUiThread();
|
||||
|
||||
// We need to coordinate with Gecko when pausing composition, to ensure
|
||||
// that Gecko never executes a draw event while the compositor is paused.
|
||||
// This is sent synchronously to make sure that we don't attempt to use
|
||||
// any outstanding Surfaces after we call this (such as from a
|
||||
// serverSurfaceDestroyed notification), and to make sure that any in-flight
|
||||
// Gecko draw events have been processed. When this returns, composition is
|
||||
// definitely paused -- it'll synchronize with the Gecko event loop, which
|
||||
// in turn will synchronize with the compositor thread.
|
||||
if (mCompositorCreated) {
|
||||
pauseCompositor();
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
mServerSurfaceValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
void serverSurfaceChanged(int newWidth, int newHeight) {
|
||||
ThreadUtils.assertOnUiThread();
|
||||
|
||||
synchronized (this) {
|
||||
mWidth = newWidth;
|
||||
mHeight = newHeight;
|
||||
mServerSurfaceValid = true;
|
||||
}
|
||||
|
||||
updateCompositor();
|
||||
}
|
||||
|
||||
void updateCompositor() {
|
||||
ThreadUtils.assertOnUiThread();
|
||||
|
||||
if (mView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mCompositorCreated) {
|
||||
// If the compositor has already been created, just resume it instead. We don't need
|
||||
// to block here because if the surface is destroyed before the compositor grabs it,
|
||||
// we can handle that gracefully (i.e. the compositor will remain paused).
|
||||
resumeCompositor(mWidth, mHeight);
|
||||
return;
|
||||
}
|
||||
|
||||
// Only try to create the compositor if we have a valid surface and gecko is up. When these
|
||||
// two conditions are satisfied, we can be relatively sure that the compositor creation will
|
||||
// happen without needing to block anywhere. Do it with a synchronous Gecko event so that the
|
||||
// Android doesn't have a chance to destroy our surface in between.
|
||||
if (isServerSurfaceValid() && mView.getLayerClient().isGeckoReady()) {
|
||||
createCompositor(mWidth, mHeight);
|
||||
compositorCreated();
|
||||
}
|
||||
}
|
||||
|
||||
void compositorCreated() {
|
||||
// This is invoked on the compositor thread, while the java UI thread
|
||||
// is blocked on the gecko sync event in updateCompositor() above
|
||||
mCompositorCreated = true;
|
||||
}
|
||||
|
||||
public boolean isServerSurfaceValid() {
|
||||
return mServerSurfaceValid;
|
||||
}
|
||||
|
||||
@WrapForJNI(allowMultithread = true)
|
||||
private synchronized Object getSurface() {
|
||||
if (mView != null && isServerSurfaceValid()) {
|
||||
return mView.getSurface();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
void resumeCompositor(int width, int height) {
|
||||
// Asking Gecko to resume the compositor takes too long (see
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=735230#c23), so we
|
||||
// resume the compositor directly. We still need to inform Gecko about
|
||||
// the compositor resuming, so that Gecko knows that it can now draw.
|
||||
// It is important to not notify Gecko until after the compositor has
|
||||
// been resumed, otherwise Gecko may send updates that get dropped.
|
||||
if (isServerSurfaceValid() && mCompositorCreated) {
|
||||
syncResumeResizeCompositor(width, height);
|
||||
mView.requestRender();
|
||||
}
|
||||
}
|
||||
|
||||
/* package */ void invalidateAndScheduleComposite() {
|
||||
if (mCompositorCreated) {
|
||||
syncInvalidateAndScheduleComposite();
|
||||
}
|
||||
}
|
||||
|
||||
@WrapForJNI
|
||||
private void destroy() {
|
||||
// The nsWindow has been closed. First mark our compositor as destroyed.
|
||||
mCompositorCreated = false;
|
||||
|
||||
// Then clear out any pending calls on the UI thread by disposing on the UI thread.
|
||||
ThreadUtils.postToUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GLController.this.disposeNative();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static class GLControllerException extends RuntimeException {
|
||||
public static final long serialVersionUID = 1L;
|
||||
|
||||
GLControllerException(String e) {
|
||||
super(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -174,7 +174,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
|||
mView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mView.getGLController().updateCompositor();
|
||||
mView.updateCompositor();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -283,8 +283,8 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
|||
}
|
||||
|
||||
if (mView != null) {
|
||||
mView.getGLController().onSizeChanged(mWindowSize.width, mWindowSize.height,
|
||||
mScreenSize.width, mScreenSize.height);
|
||||
mView.notifySizeChanged(mWindowSize.width, mWindowSize.height,
|
||||
mScreenSize.width, mScreenSize.height);
|
||||
}
|
||||
|
||||
String json = "";
|
||||
|
@ -973,9 +973,8 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
|||
/** Implementation of LayerView.Listener */
|
||||
@Override
|
||||
public void renderRequested() {
|
||||
final GLController glController = mView.getGLController();
|
||||
if (glController != null) {
|
||||
glController.invalidateAndScheduleComposite();
|
||||
if (mView != null) {
|
||||
mView.invalidateAndScheduleComposite();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -985,7 +984,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
|||
// We need to make sure a draw happens synchronously at this point,
|
||||
// but resizing the surface before the SurfaceView has resized will
|
||||
// cause a visible jump.
|
||||
mView.getGLController().resumeCompositor(width, height);
|
||||
mView.resumeCompositor(width, height);
|
||||
}
|
||||
|
||||
/** Implementation of LayerView.Listener */
|
||||
|
|
|
@ -18,8 +18,10 @@ import org.mozilla.gecko.GeckoAccessibility;
|
|||
import org.mozilla.gecko.GeckoAppShell;
|
||||
import org.mozilla.gecko.GeckoEvent;
|
||||
import org.mozilla.gecko.GeckoThread;
|
||||
import org.mozilla.gecko.mozglue.JNIObject;
|
||||
import org.mozilla.gecko.Tab;
|
||||
import org.mozilla.gecko.Tabs;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.gecko.ZoomConstraints;
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -51,7 +53,6 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
|
|||
private GeckoLayerClient mLayerClient;
|
||||
private PanZoomController mPanZoomController;
|
||||
private DynamicToolbarAnimator mToolbarAnimator;
|
||||
private GLController mGLController;
|
||||
private LayerRenderer mRenderer;
|
||||
/* Must be a PAINT_xxx constant */
|
||||
private int mPaintState;
|
||||
|
@ -71,6 +72,65 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
|
|||
/* This should only be modified on the Java UI thread. */
|
||||
private final Overscroll mOverscroll;
|
||||
|
||||
|
||||
private boolean mServerSurfaceValid;
|
||||
private int mWidth, mHeight;
|
||||
|
||||
/* This is written by the compositor thread (while the UI thread
|
||||
* is blocked on it) and read by the UI thread. */
|
||||
private volatile boolean mCompositorCreated;
|
||||
|
||||
|
||||
@WrapForJNI(allowMultithread = true)
|
||||
protected class Compositor extends JNIObject {
|
||||
public Compositor() {
|
||||
}
|
||||
|
||||
@Override protected native void disposeNative();
|
||||
|
||||
// Gecko thread sets its Java instances; does not block UI thread.
|
||||
/* package */ native void attachToJava(GeckoLayerClient layerClient,
|
||||
NativePanZoomController npzc);
|
||||
|
||||
/* package */ native void onSizeChanged(int windowWidth, int windowHeight,
|
||||
int screenWidth, int screenHeight);
|
||||
|
||||
// Gecko thread creates compositor; blocks UI thread.
|
||||
/* package */ native void createCompositor(int width, int height);
|
||||
|
||||
// Gecko thread pauses compositor; blocks UI thread.
|
||||
/* package */ native void syncPauseCompositor();
|
||||
|
||||
// UI thread resumes compositor and notifies Gecko thread; does not block UI thread.
|
||||
/* package */ native void syncResumeResizeCompositor(int width, int height);
|
||||
|
||||
/* package */ native void syncInvalidateAndScheduleComposite();
|
||||
|
||||
private synchronized Object getSurface() {
|
||||
if (LayerView.this.mServerSurfaceValid) {
|
||||
return LayerView.this.getSurface();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void destroy() {
|
||||
// The nsWindow has been closed. First mark our compositor as destroyed.
|
||||
LayerView.this.mCompositorCreated = false;
|
||||
|
||||
// Then clear out any pending calls on the UI thread by disposing on the UI thread.
|
||||
ThreadUtils.postToUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
disposeNative();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Compositor mCompositor;
|
||||
|
||||
|
||||
/* Flags used to determine when to show the painted surface. */
|
||||
public static final int PAINT_START = 0;
|
||||
public static final int PAINT_BEFORE_FIRST = 1;
|
||||
|
@ -112,6 +172,8 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
|
|||
mOverscroll = null;
|
||||
}
|
||||
Tabs.registerOnTabsChangedListener(this);
|
||||
|
||||
mCompositor = new Compositor();
|
||||
}
|
||||
|
||||
public LayerView(Context context) {
|
||||
|
@ -194,11 +256,8 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
|
|||
if (mRenderer != null) {
|
||||
mRenderer.destroy();
|
||||
}
|
||||
if (mGLController != null) {
|
||||
if (mGLController.mView == this) {
|
||||
mGLController.mView = null;
|
||||
}
|
||||
mGLController = null;
|
||||
if (mCompositor != null) {
|
||||
mCompositor = null;
|
||||
}
|
||||
Tabs.unregisterOnTabsChangedListener(this);
|
||||
}
|
||||
|
@ -331,6 +390,8 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
|
|||
SurfaceHolder holder = mSurfaceView.getHolder();
|
||||
holder.addCallback(new SurfaceListener());
|
||||
}
|
||||
|
||||
attachCompositor();
|
||||
}
|
||||
|
||||
// Don't expose GeckoLayerClient to things outside this package; only expose it as an Object
|
||||
|
@ -447,25 +508,80 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
|
|||
return mListener;
|
||||
}
|
||||
|
||||
public void setGLController(final GLController glController) {
|
||||
mGLController = glController;
|
||||
glController.mView = this;
|
||||
|
||||
private void attachCompositor() {
|
||||
final NativePanZoomController npzc = AppConstants.MOZ_ANDROID_APZ ?
|
||||
(NativePanZoomController) mPanZoomController : null;
|
||||
|
||||
if (GeckoThread.isStateAtLeast(GeckoThread.State.PROFILE_READY)) {
|
||||
glController.attachToJava(mLayerClient, npzc);
|
||||
mCompositor.attachToJava(mLayerClient, npzc);
|
||||
} else {
|
||||
GeckoThread.queueNativeCallUntil(GeckoThread.State.PROFILE_READY,
|
||||
glController, "attachToJava",
|
||||
mCompositor, "attachToJava",
|
||||
GeckoLayerClient.class, mLayerClient,
|
||||
NativePanZoomController.class, npzc);
|
||||
}
|
||||
}
|
||||
|
||||
public GLController getGLController() {
|
||||
return mGLController;
|
||||
protected Compositor getCompositor() {
|
||||
return mCompositor;
|
||||
}
|
||||
|
||||
void serverSurfaceChanged(int newWidth, int newHeight) {
|
||||
ThreadUtils.assertOnUiThread();
|
||||
|
||||
synchronized (this) {
|
||||
mWidth = newWidth;
|
||||
mHeight = newHeight;
|
||||
mServerSurfaceValid = true;
|
||||
}
|
||||
|
||||
updateCompositor();
|
||||
}
|
||||
|
||||
void updateCompositor() {
|
||||
ThreadUtils.assertOnUiThread();
|
||||
|
||||
if (mCompositorCreated) {
|
||||
// If the compositor has already been created, just resume it instead. We don't need
|
||||
// to block here because if the surface is destroyed before the compositor grabs it,
|
||||
// we can handle that gracefully (i.e. the compositor will remain paused).
|
||||
resumeCompositor(mWidth, mHeight);
|
||||
return;
|
||||
}
|
||||
|
||||
// Only try to create the compositor if we have a valid surface and gecko is up. When these
|
||||
// two conditions are satisfied, we can be relatively sure that the compositor creation will
|
||||
// happen without needing to block anywhere. Do it with a synchronous Gecko event so that the
|
||||
// Android doesn't have a chance to destroy our surface in between.
|
||||
if (mServerSurfaceValid && getLayerClient().isGeckoReady()) {
|
||||
mCompositor.createCompositor(mWidth, mHeight);
|
||||
compositorCreated();
|
||||
}
|
||||
}
|
||||
|
||||
void compositorCreated() {
|
||||
// This is invoked on the compositor thread, while the java UI thread
|
||||
// is blocked on the gecko sync event in updateCompositor() above
|
||||
mCompositorCreated = true;
|
||||
}
|
||||
|
||||
void resumeCompositor(int width, int height) {
|
||||
// Asking Gecko to resume the compositor takes too long (see
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=735230#c23), so we
|
||||
// resume the compositor directly. We still need to inform Gecko about
|
||||
// the compositor resuming, so that Gecko knows that it can now draw.
|
||||
// It is important to not notify Gecko until after the compositor has
|
||||
// been resumed, otherwise Gecko may send updates that get dropped.
|
||||
if (mServerSurfaceValid && mCompositorCreated) {
|
||||
mCompositor.syncResumeResizeCompositor(width, height);
|
||||
requestRender();
|
||||
}
|
||||
}
|
||||
|
||||
/* package */ void invalidateAndScheduleComposite() {
|
||||
if (mCompositorCreated) {
|
||||
mCompositor.syncInvalidateAndScheduleComposite();
|
||||
}
|
||||
}
|
||||
|
||||
/* When using a SurfaceView (mSurfaceView != null), resizing happens in two
|
||||
|
@ -487,7 +603,7 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
|
|||
* TextureView instead of a SurfaceView, the first phase is skipped.
|
||||
*/
|
||||
private void onSizeChanged(int width, int height) {
|
||||
if (!mGLController.isServerSurfaceValid() || mSurfaceView == null) {
|
||||
if (!mServerSurfaceValid || mSurfaceView == null) {
|
||||
surfaceChanged(width, height);
|
||||
return;
|
||||
}
|
||||
|
@ -502,7 +618,7 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
|
|||
}
|
||||
|
||||
private void surfaceChanged(int width, int height) {
|
||||
mGLController.serverSurfaceChanged(width, height);
|
||||
serverSurfaceChanged(width, height);
|
||||
|
||||
if (mListener != null) {
|
||||
mListener.surfaceChanged(width, height);
|
||||
|
@ -513,8 +629,32 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
|
|||
}
|
||||
}
|
||||
|
||||
void notifySizeChanged(int windowWidth, int windowHeight, int screenWidth, int screenHeight) {
|
||||
mCompositor.onSizeChanged(windowWidth, windowHeight, screenWidth, screenHeight);
|
||||
}
|
||||
|
||||
void serverSurfaceDestroyed() {
|
||||
ThreadUtils.assertOnUiThread();
|
||||
|
||||
// We need to coordinate with Gecko when pausing composition, to ensure
|
||||
// that Gecko never executes a draw event while the compositor is paused.
|
||||
// This is sent synchronously to make sure that we don't attempt to use
|
||||
// any outstanding Surfaces after we call this (such as from a
|
||||
// serverSurfaceDestroyed notification), and to make sure that any in-flight
|
||||
// Gecko draw events have been processed. When this returns, composition is
|
||||
// definitely paused -- it'll synchronize with the Gecko event loop, which
|
||||
// in turn will synchronize with the compositor thread.
|
||||
if (mCompositorCreated) {
|
||||
mCompositor.syncPauseCompositor();
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
mServerSurfaceValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void onDestroyed() {
|
||||
mGLController.serverSurfaceDestroyed();
|
||||
serverSurfaceDestroyed();
|
||||
}
|
||||
|
||||
public Object getNativeWindow() {
|
||||
|
@ -608,7 +748,7 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
|
|||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
if (changed && mParent.mGLController.isServerSurfaceValid()) {
|
||||
if (changed && mParent.mServerSurfaceValid) {
|
||||
mParent.surfaceChanged(right - left, bottom - top);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -369,7 +369,6 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
|
|||
'gfx/FloatSize.java',
|
||||
'gfx/FullScreenState.java',
|
||||
'gfx/GeckoLayerClient.java',
|
||||
'gfx/GLController.java',
|
||||
'gfx/ImmutableViewportMetrics.java',
|
||||
'gfx/IntSize.java',
|
||||
'gfx/JavaPanZoomController.java',
|
||||
|
|
|
@ -346,41 +346,41 @@ const JNINativeMethod ThumbnailHelper::Natives<Impl>::methods[] = {
|
|||
};
|
||||
|
||||
template<class Impl>
|
||||
class GLController::Natives : public mozilla::jni::NativeImpl<GLController, Impl>
|
||||
class LayerView::Compositor::Natives : public mozilla::jni::NativeImpl<Compositor, Impl>
|
||||
{
|
||||
public:
|
||||
static const JNINativeMethod methods[7];
|
||||
};
|
||||
|
||||
template<class Impl>
|
||||
const JNINativeMethod GLController::Natives<Impl>::methods[] = {
|
||||
const JNINativeMethod LayerView::Compositor::Natives<Impl>::methods[] = {
|
||||
|
||||
mozilla::jni::MakeNativeMethod<GLController::AttachToJava_t>(
|
||||
mozilla::jni::NativeStub<GLController::AttachToJava_t, Impl>
|
||||
mozilla::jni::MakeNativeMethod<LayerView::Compositor::AttachToJava_t>(
|
||||
mozilla::jni::NativeStub<LayerView::Compositor::AttachToJava_t, Impl>
|
||||
::template Wrap<&Impl::AttachToJava>),
|
||||
|
||||
mozilla::jni::MakeNativeMethod<GLController::CreateCompositor_t>(
|
||||
mozilla::jni::NativeStub<GLController::CreateCompositor_t, Impl>
|
||||
mozilla::jni::MakeNativeMethod<LayerView::Compositor::CreateCompositor_t>(
|
||||
mozilla::jni::NativeStub<LayerView::Compositor::CreateCompositor_t, Impl>
|
||||
::template Wrap<&Impl::CreateCompositor>),
|
||||
|
||||
mozilla::jni::MakeNativeMethod<GLController::DisposeNative_t>(
|
||||
mozilla::jni::NativeStub<GLController::DisposeNative_t, Impl>
|
||||
mozilla::jni::MakeNativeMethod<LayerView::Compositor::DisposeNative_t>(
|
||||
mozilla::jni::NativeStub<LayerView::Compositor::DisposeNative_t, Impl>
|
||||
::template Wrap<&Impl::DisposeNative>),
|
||||
|
||||
mozilla::jni::MakeNativeMethod<GLController::OnSizeChanged_t>(
|
||||
mozilla::jni::NativeStub<GLController::OnSizeChanged_t, Impl>
|
||||
mozilla::jni::MakeNativeMethod<LayerView::Compositor::OnSizeChanged_t>(
|
||||
mozilla::jni::NativeStub<LayerView::Compositor::OnSizeChanged_t, Impl>
|
||||
::template Wrap<&Impl::OnSizeChanged>),
|
||||
|
||||
mozilla::jni::MakeNativeMethod<GLController::PauseCompositor_t>(
|
||||
mozilla::jni::NativeStub<GLController::PauseCompositor_t, Impl>
|
||||
::template Wrap<&Impl::PauseCompositor>),
|
||||
|
||||
mozilla::jni::MakeNativeMethod<GLController::SyncInvalidateAndScheduleComposite_t>(
|
||||
mozilla::jni::NativeStub<GLController::SyncInvalidateAndScheduleComposite_t, Impl>
|
||||
mozilla::jni::MakeNativeMethod<LayerView::Compositor::SyncInvalidateAndScheduleComposite_t>(
|
||||
mozilla::jni::NativeStub<LayerView::Compositor::SyncInvalidateAndScheduleComposite_t, Impl>
|
||||
::template Wrap<&Impl::SyncInvalidateAndScheduleComposite>),
|
||||
|
||||
mozilla::jni::MakeNativeMethod<GLController::SyncResumeResizeCompositor_t>(
|
||||
mozilla::jni::NativeStub<GLController::SyncResumeResizeCompositor_t, Impl>
|
||||
mozilla::jni::MakeNativeMethod<LayerView::Compositor::SyncPauseCompositor_t>(
|
||||
mozilla::jni::NativeStub<LayerView::Compositor::SyncPauseCompositor_t, Impl>
|
||||
::template Wrap<&Impl::SyncPauseCompositor>),
|
||||
|
||||
mozilla::jni::MakeNativeMethod<LayerView::Compositor::SyncResumeResizeCompositor_t>(
|
||||
mozilla::jni::NativeStub<LayerView::Compositor::SyncResumeResizeCompositor_t, Impl>
|
||||
::template Wrap<&Impl::SyncResumeResizeCompositor>)
|
||||
};
|
||||
|
||||
|
|
|
@ -1144,14 +1144,6 @@ constexpr char GeckoView::Window::Open_t::signature[];
|
|||
constexpr char GeckoView::Window::Reattach_t::name[];
|
||||
constexpr char GeckoView::Window::Reattach_t::signature[];
|
||||
|
||||
constexpr char GeckoView::Window::GlController_t::name[];
|
||||
constexpr char GeckoView::Window::GlController_t::signature[];
|
||||
|
||||
auto GeckoView::Window::GlController() const -> mozilla::jni::Object::LocalRef
|
||||
{
|
||||
return mozilla::jni::Field<GlController_t>::Get(Window::mCtx, nullptr);
|
||||
}
|
||||
|
||||
const char PrefsHelper::name[] =
|
||||
"org/mozilla/gecko/PrefsHelper";
|
||||
|
||||
|
@ -1235,46 +1227,6 @@ auto DisplayPortMetrics::Resolution() const -> float
|
|||
return mozilla::jni::Field<Resolution_t>::Get(DisplayPortMetrics::mCtx, nullptr);
|
||||
}
|
||||
|
||||
const char GLController::name[] =
|
||||
"org/mozilla/gecko/gfx/GLController";
|
||||
|
||||
constexpr char GLController::AttachToJava_t::name[];
|
||||
constexpr char GLController::AttachToJava_t::signature[];
|
||||
|
||||
constexpr char GLController::CreateCompositor_t::name[];
|
||||
constexpr char GLController::CreateCompositor_t::signature[];
|
||||
|
||||
constexpr char GLController::Destroy_t::name[];
|
||||
constexpr char GLController::Destroy_t::signature[];
|
||||
|
||||
auto GLController::Destroy() const -> void
|
||||
{
|
||||
return mozilla::jni::Method<Destroy_t>::Call(GLController::mCtx, nullptr);
|
||||
}
|
||||
|
||||
constexpr char GLController::DisposeNative_t::name[];
|
||||
constexpr char GLController::DisposeNative_t::signature[];
|
||||
|
||||
constexpr char GLController::GetSurface_t::name[];
|
||||
constexpr char GLController::GetSurface_t::signature[];
|
||||
|
||||
auto GLController::GetSurface() const -> mozilla::jni::Object::LocalRef
|
||||
{
|
||||
return mozilla::jni::Method<GetSurface_t>::Call(GLController::mCtx, nullptr);
|
||||
}
|
||||
|
||||
constexpr char GLController::OnSizeChanged_t::name[];
|
||||
constexpr char GLController::OnSizeChanged_t::signature[];
|
||||
|
||||
constexpr char GLController::PauseCompositor_t::name[];
|
||||
constexpr char GLController::PauseCompositor_t::signature[];
|
||||
|
||||
constexpr char GLController::SyncInvalidateAndScheduleComposite_t::name[];
|
||||
constexpr char GLController::SyncInvalidateAndScheduleComposite_t::signature[];
|
||||
|
||||
constexpr char GLController::SyncResumeResizeCompositor_t::name[];
|
||||
constexpr char GLController::SyncResumeResizeCompositor_t::signature[];
|
||||
|
||||
const char GeckoLayerClient::name[] =
|
||||
"org/mozilla/gecko/gfx/GeckoLayerClient";
|
||||
|
||||
|
@ -1450,6 +1402,54 @@ auto LayerView::updateZoomedView(mozilla::jni::ByteBuffer::Param a0) -> void
|
|||
return mozilla::jni::Method<updateZoomedView_t>::Call(LayerView::Context(), nullptr, a0);
|
||||
}
|
||||
|
||||
const char LayerView::Compositor::name[] =
|
||||
"org/mozilla/gecko/gfx/LayerView$Compositor";
|
||||
|
||||
constexpr char LayerView::Compositor::New_t::name[];
|
||||
constexpr char LayerView::Compositor::New_t::signature[];
|
||||
|
||||
auto LayerView::Compositor::New(LayerView::Param a0) -> Compositor::LocalRef
|
||||
{
|
||||
return mozilla::jni::Constructor<New_t>::Call(Compositor::Context(), nullptr, a0);
|
||||
}
|
||||
|
||||
constexpr char LayerView::Compositor::AttachToJava_t::name[];
|
||||
constexpr char LayerView::Compositor::AttachToJava_t::signature[];
|
||||
|
||||
constexpr char LayerView::Compositor::CreateCompositor_t::name[];
|
||||
constexpr char LayerView::Compositor::CreateCompositor_t::signature[];
|
||||
|
||||
constexpr char LayerView::Compositor::Destroy_t::name[];
|
||||
constexpr char LayerView::Compositor::Destroy_t::signature[];
|
||||
|
||||
auto LayerView::Compositor::Destroy() const -> void
|
||||
{
|
||||
return mozilla::jni::Method<Destroy_t>::Call(Compositor::mCtx, nullptr);
|
||||
}
|
||||
|
||||
constexpr char LayerView::Compositor::DisposeNative_t::name[];
|
||||
constexpr char LayerView::Compositor::DisposeNative_t::signature[];
|
||||
|
||||
constexpr char LayerView::Compositor::GetSurface_t::name[];
|
||||
constexpr char LayerView::Compositor::GetSurface_t::signature[];
|
||||
|
||||
auto LayerView::Compositor::GetSurface() const -> mozilla::jni::Object::LocalRef
|
||||
{
|
||||
return mozilla::jni::Method<GetSurface_t>::Call(Compositor::mCtx, nullptr);
|
||||
}
|
||||
|
||||
constexpr char LayerView::Compositor::OnSizeChanged_t::name[];
|
||||
constexpr char LayerView::Compositor::OnSizeChanged_t::signature[];
|
||||
|
||||
constexpr char LayerView::Compositor::SyncInvalidateAndScheduleComposite_t::name[];
|
||||
constexpr char LayerView::Compositor::SyncInvalidateAndScheduleComposite_t::signature[];
|
||||
|
||||
constexpr char LayerView::Compositor::SyncPauseCompositor_t::name[];
|
||||
constexpr char LayerView::Compositor::SyncPauseCompositor_t::signature[];
|
||||
|
||||
constexpr char LayerView::Compositor::SyncResumeResizeCompositor_t::name[];
|
||||
constexpr char LayerView::Compositor::SyncResumeResizeCompositor_t::signature[];
|
||||
|
||||
const char NativePanZoomController::name[] =
|
||||
"org/mozilla/gecko/gfx/NativePanZoomController";
|
||||
|
||||
|
|
|
@ -2806,7 +2806,7 @@ public:
|
|||
int32_t> Args;
|
||||
static constexpr char name[] = "open";
|
||||
static constexpr char signature[] =
|
||||
"(Lorg/mozilla/gecko/GeckoView$Window;Lorg/mozilla/gecko/GeckoView;Lorg/mozilla/gecko/gfx/GLController;Ljava/lang/String;II)V";
|
||||
"(Lorg/mozilla/gecko/GeckoView$Window;Lorg/mozilla/gecko/GeckoView;Lorg/mozilla/gecko/gfx/LayerView$Compositor;Ljava/lang/String;II)V";
|
||||
static const bool isStatic = true;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
|
@ -2817,30 +2817,16 @@ public:
|
|||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
GeckoView::Param> Args;
|
||||
GeckoView::Param,
|
||||
mozilla::jni::Object::Param> Args;
|
||||
static constexpr char name[] = "reattach";
|
||||
static constexpr char signature[] =
|
||||
"(Lorg/mozilla/gecko/GeckoView;)V";
|
||||
"(Lorg/mozilla/gecko/GeckoView;Lorg/mozilla/gecko/gfx/LayerView$Compositor;)V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
struct GlController_t {
|
||||
typedef Window Owner;
|
||||
typedef mozilla::jni::Object::LocalRef ReturnType;
|
||||
typedef mozilla::jni::Object::Param SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "glController";
|
||||
static constexpr char signature[] =
|
||||
"Lorg/mozilla/gecko/gfx/GLController;";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
auto GlController() const -> mozilla::jni::Object::LocalRef;
|
||||
|
||||
static const bool isMultithreaded = true;
|
||||
|
||||
template<class Impl> class Natives;
|
||||
|
@ -3108,149 +3094,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
class GLController : public mozilla::jni::ObjectBase<GLController, jobject>
|
||||
{
|
||||
public:
|
||||
static const char name[];
|
||||
|
||||
explicit GLController(const Context& ctx) : ObjectBase<GLController, jobject>(ctx) {}
|
||||
|
||||
struct AttachToJava_t {
|
||||
typedef GLController Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
mozilla::jni::Object::Param,
|
||||
mozilla::jni::Object::Param> Args;
|
||||
static constexpr char name[] = "attachToJava";
|
||||
static constexpr char signature[] =
|
||||
"(Lorg/mozilla/gecko/gfx/GeckoLayerClient;Lorg/mozilla/gecko/gfx/NativePanZoomController;)V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
struct CreateCompositor_t {
|
||||
typedef GLController Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
int32_t,
|
||||
int32_t> Args;
|
||||
static constexpr char name[] = "createCompositor";
|
||||
static constexpr char signature[] =
|
||||
"(II)V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
struct Destroy_t {
|
||||
typedef GLController Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "destroy";
|
||||
static constexpr char signature[] =
|
||||
"()V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
auto Destroy() const -> void;
|
||||
|
||||
struct DisposeNative_t {
|
||||
typedef GLController Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "disposeNative";
|
||||
static constexpr char signature[] =
|
||||
"()V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
struct GetSurface_t {
|
||||
typedef GLController Owner;
|
||||
typedef mozilla::jni::Object::LocalRef ReturnType;
|
||||
typedef mozilla::jni::Object::Param SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "getSurface";
|
||||
static constexpr char signature[] =
|
||||
"()Ljava/lang/Object;";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
auto GetSurface() const -> mozilla::jni::Object::LocalRef;
|
||||
|
||||
struct OnSizeChanged_t {
|
||||
typedef GLController Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
int32_t,
|
||||
int32_t,
|
||||
int32_t,
|
||||
int32_t> Args;
|
||||
static constexpr char name[] = "onSizeChanged";
|
||||
static constexpr char signature[] =
|
||||
"(IIII)V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
struct PauseCompositor_t {
|
||||
typedef GLController Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "pauseCompositor";
|
||||
static constexpr char signature[] =
|
||||
"()V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
struct SyncInvalidateAndScheduleComposite_t {
|
||||
typedef GLController Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "syncInvalidateAndScheduleComposite";
|
||||
static constexpr char signature[] =
|
||||
"()V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
struct SyncResumeResizeCompositor_t {
|
||||
typedef GLController Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
int32_t,
|
||||
int32_t> Args;
|
||||
static constexpr char name[] = "syncResumeResizeCompositor";
|
||||
static constexpr char signature[] =
|
||||
"(II)V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
static const bool isMultithreaded = true;
|
||||
|
||||
template<class Impl> class Natives;
|
||||
};
|
||||
|
||||
class GeckoLayerClient : public mozilla::jni::ObjectBase<GeckoLayerClient, jobject>
|
||||
{
|
||||
public:
|
||||
|
@ -3659,6 +3502,8 @@ public:
|
|||
|
||||
explicit LayerView(const Context& ctx) : ObjectBase<LayerView, jobject>(ctx) {}
|
||||
|
||||
class Compositor;
|
||||
|
||||
struct updateZoomedView_t {
|
||||
typedef LayerView Owner;
|
||||
typedef void ReturnType;
|
||||
|
@ -3679,6 +3524,165 @@ public:
|
|||
|
||||
};
|
||||
|
||||
class LayerView::Compositor : public mozilla::jni::ObjectBase<Compositor, jobject>
|
||||
{
|
||||
public:
|
||||
static const char name[];
|
||||
|
||||
explicit Compositor(const Context& ctx) : ObjectBase<Compositor, jobject>(ctx) {}
|
||||
|
||||
struct New_t {
|
||||
typedef Compositor Owner;
|
||||
typedef Compositor::LocalRef ReturnType;
|
||||
typedef Compositor::Param SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
LayerView::Param> Args;
|
||||
static constexpr char name[] = "<init>";
|
||||
static constexpr char signature[] =
|
||||
"(Lorg/mozilla/gecko/gfx/LayerView;)V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
static auto New(LayerView::Param) -> Compositor::LocalRef;
|
||||
|
||||
struct AttachToJava_t {
|
||||
typedef Compositor Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
mozilla::jni::Object::Param,
|
||||
mozilla::jni::Object::Param> Args;
|
||||
static constexpr char name[] = "attachToJava";
|
||||
static constexpr char signature[] =
|
||||
"(Lorg/mozilla/gecko/gfx/GeckoLayerClient;Lorg/mozilla/gecko/gfx/NativePanZoomController;)V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
struct CreateCompositor_t {
|
||||
typedef Compositor Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
int32_t,
|
||||
int32_t> Args;
|
||||
static constexpr char name[] = "createCompositor";
|
||||
static constexpr char signature[] =
|
||||
"(II)V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
struct Destroy_t {
|
||||
typedef Compositor Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "destroy";
|
||||
static constexpr char signature[] =
|
||||
"()V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
auto Destroy() const -> void;
|
||||
|
||||
struct DisposeNative_t {
|
||||
typedef Compositor Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "disposeNative";
|
||||
static constexpr char signature[] =
|
||||
"()V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
struct GetSurface_t {
|
||||
typedef Compositor Owner;
|
||||
typedef mozilla::jni::Object::LocalRef ReturnType;
|
||||
typedef mozilla::jni::Object::Param SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "getSurface";
|
||||
static constexpr char signature[] =
|
||||
"()Ljava/lang/Object;";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
auto GetSurface() const -> mozilla::jni::Object::LocalRef;
|
||||
|
||||
struct OnSizeChanged_t {
|
||||
typedef Compositor Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
int32_t,
|
||||
int32_t,
|
||||
int32_t,
|
||||
int32_t> Args;
|
||||
static constexpr char name[] = "onSizeChanged";
|
||||
static constexpr char signature[] =
|
||||
"(IIII)V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
struct SyncInvalidateAndScheduleComposite_t {
|
||||
typedef Compositor Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "syncInvalidateAndScheduleComposite";
|
||||
static constexpr char signature[] =
|
||||
"()V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
struct SyncPauseCompositor_t {
|
||||
typedef Compositor Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "syncPauseCompositor";
|
||||
static constexpr char signature[] =
|
||||
"()V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
struct SyncResumeResizeCompositor_t {
|
||||
typedef Compositor Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
int32_t,
|
||||
int32_t> Args;
|
||||
static constexpr char name[] = "syncResumeResizeCompositor";
|
||||
static constexpr char signature[] =
|
||||
"(II)V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
static const bool isMultithreaded = true;
|
||||
|
||||
template<class Impl> class Natives;
|
||||
};
|
||||
|
||||
class NativePanZoomController : public mozilla::jni::ObjectBase<NativePanZoomController, jobject>
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -246,7 +246,7 @@ public:
|
|||
// Create and attach a window.
|
||||
static void Open(const jni::Class::LocalRef& aCls,
|
||||
GeckoView::Window::Param aWindow,
|
||||
GeckoView::Param aView, jni::Object::Param aGLController,
|
||||
GeckoView::Param aView, jni::Object::Param aCompositor,
|
||||
jni::String::Param aChromeURI,
|
||||
int32_t aWidth, int32_t aHeight);
|
||||
|
||||
|
@ -254,7 +254,7 @@ public:
|
|||
void Close();
|
||||
|
||||
// Reattach this nsWindow to a new GeckoView.
|
||||
void Reattach(GeckoView::Param aView);
|
||||
void Reattach(GeckoView::Param aView, jni::Object::Param aCompositor);
|
||||
|
||||
void LoadUri(jni::String::Param aUri, int32_t aFlags);
|
||||
|
||||
|
@ -874,34 +874,34 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
* GLController has some unique requirements for its native calls, so make it
|
||||
* Compositor has some unique requirements for its native calls, so make it
|
||||
* separate from GeckoViewSupport.
|
||||
*/
|
||||
class nsWindow::GLControllerSupport final
|
||||
: public GLController::Natives<GLControllerSupport>
|
||||
, public SupportsWeakPtr<GLControllerSupport>
|
||||
class nsWindow::LayerViewSupport final
|
||||
: public LayerView::Compositor::Natives<LayerViewSupport>
|
||||
, public SupportsWeakPtr<LayerViewSupport>
|
||||
, public UsesGeckoThreadProxy
|
||||
{
|
||||
nsWindow& window;
|
||||
GLController::GlobalRef mGLController;
|
||||
LayerView::Compositor::GlobalRef mCompositor;
|
||||
GeckoLayerClient::GlobalRef mLayerClient;
|
||||
Atomic<bool, ReleaseAcquire> mCompositorPaused;
|
||||
mozilla::jni::GlobalRef<mozilla::jni::Object> mSurface;
|
||||
|
||||
// In order to use Event::HasSameTypeAs in PostTo(), we cannot make
|
||||
// GLControllerEvent a template because each template instantiation is
|
||||
// a different type. So implement GLControllerEvent as a ProxyEvent.
|
||||
class GLControllerEvent final : public nsAppShell::ProxyEvent
|
||||
// LayerViewEvent a template because each template instantiation is
|
||||
// a different type. So implement LayerViewEvent as a ProxyEvent.
|
||||
class LayerViewEvent final : public nsAppShell::ProxyEvent
|
||||
{
|
||||
using Event = nsAppShell::Event;
|
||||
|
||||
public:
|
||||
static UniquePtr<Event> MakeEvent(UniquePtr<Event>&& event)
|
||||
{
|
||||
return MakeUnique<GLControllerEvent>(mozilla::Move(event));
|
||||
return MakeUnique<LayerViewEvent>(mozilla::Move(event));
|
||||
}
|
||||
|
||||
GLControllerEvent(UniquePtr<Event>&& event)
|
||||
LayerViewEvent(UniquePtr<Event>&& event)
|
||||
: nsAppShell::ProxyEvent(mozilla::Move(event))
|
||||
{}
|
||||
|
||||
|
@ -922,46 +922,43 @@ class nsWindow::GLControllerSupport final
|
|||
};
|
||||
|
||||
public:
|
||||
typedef GLController::Natives<GLControllerSupport> Base;
|
||||
typedef LayerView::Compositor::Natives<LayerViewSupport> Base;
|
||||
|
||||
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(GLControllerSupport);
|
||||
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(LayerViewSupport);
|
||||
|
||||
template<class Functor>
|
||||
static void OnNativeCall(Functor&& aCall)
|
||||
{
|
||||
if (aCall.IsTarget(&GLControllerSupport::CreateCompositor)) {
|
||||
if (aCall.IsTarget(&LayerViewSupport::CreateCompositor)) {
|
||||
|
||||
// These calls are blocking.
|
||||
// This call is blocking.
|
||||
nsAppShell::SyncRunEvent(WindowEvent<Functor>(
|
||||
mozilla::Move(aCall)), &GLControllerEvent::MakeEvent);
|
||||
mozilla::Move(aCall)), &LayerViewEvent::MakeEvent);
|
||||
return;
|
||||
|
||||
} else if (aCall.IsTarget(&GLControllerSupport::PauseCompositor)) {
|
||||
aCall.SetTarget(&GLControllerSupport::SyncPauseCompositor);
|
||||
(Functor(aCall))();
|
||||
return;
|
||||
} else if (aCall.IsTarget(
|
||||
&GLControllerSupport::SyncResumeResizeCompositor)) {
|
||||
&LayerViewSupport::SyncResumeResizeCompositor)) {
|
||||
// This call is synchronous. Perform the original call using a copy
|
||||
// of the lambda. Then redirect the original lambda to
|
||||
// OnResumedCompositor, to be run on the Gecko thread. We use
|
||||
// Functor instead of our own lambda so that Functor can handle
|
||||
// object lifetimes for us.
|
||||
(Functor(aCall))();
|
||||
aCall.SetTarget(&GLControllerSupport::OnResumedCompositor);
|
||||
aCall.SetTarget(&LayerViewSupport::OnResumedCompositor);
|
||||
nsAppShell::PostEvent(
|
||||
mozilla::MakeUnique<GLControllerEvent>(
|
||||
mozilla::MakeUnique<LayerViewEvent>(
|
||||
mozilla::MakeUnique<WindowEvent<Functor>>(
|
||||
mozilla::Move(aCall))));
|
||||
return;
|
||||
|
||||
} else if (aCall.IsTarget(
|
||||
&GLControllerSupport::SyncInvalidateAndScheduleComposite)) {
|
||||
&LayerViewSupport::SyncInvalidateAndScheduleComposite) ||
|
||||
aCall.IsTarget(&LayerViewSupport::SyncPauseCompositor)) {
|
||||
// This call is synchronous.
|
||||
return aCall();
|
||||
}
|
||||
|
||||
// GLControllerEvent (i.e. prioritized event) applies to
|
||||
// LayerViewEvent (i.e. prioritized event) applies to
|
||||
// CreateCompositor, PauseCompositor, and OnResumedCompositor. For all
|
||||
// other events, use regular WindowEvent.
|
||||
nsAppShell::PostEvent(
|
||||
|
@ -969,21 +966,21 @@ public:
|
|||
mozilla::Move(aCall)));
|
||||
}
|
||||
|
||||
GLControllerSupport(nsWindow* aWindow,
|
||||
const GLController::LocalRef& aInstance)
|
||||
LayerViewSupport(nsWindow* aWindow,
|
||||
const LayerView::Compositor::LocalRef& aInstance)
|
||||
: window(*aWindow)
|
||||
, mGLController(aInstance)
|
||||
, mCompositor(aInstance)
|
||||
, mCompositorPaused(true)
|
||||
{
|
||||
Base::AttachNative(aInstance, this);
|
||||
}
|
||||
|
||||
~GLControllerSupport()
|
||||
~LayerViewSupport()
|
||||
{
|
||||
if (window.mNPZCSupport) {
|
||||
window.mNPZCSupport->DetachFromWindow();
|
||||
}
|
||||
mGLController->Destroy();
|
||||
mCompositor->Destroy();
|
||||
}
|
||||
|
||||
const GeckoLayerClient::Ref& GetLayerClient() const
|
||||
|
@ -998,7 +995,7 @@ public:
|
|||
|
||||
void* GetSurface()
|
||||
{
|
||||
mSurface = mGLController->GetSurface();
|
||||
mSurface = mCompositor->GetSurface();
|
||||
return mSurface.Get();
|
||||
}
|
||||
|
||||
|
@ -1018,7 +1015,7 @@ private:
|
|||
}
|
||||
|
||||
/**
|
||||
* GLController methods
|
||||
* Compositor methods
|
||||
*/
|
||||
public:
|
||||
using Base::DisposeNative;
|
||||
|
@ -1073,18 +1070,6 @@ public:
|
|||
OnResumedCompositor(aWidth, aHeight);
|
||||
}
|
||||
|
||||
void PauseCompositor()
|
||||
{
|
||||
// The compositor gets paused when the app is about to go into the
|
||||
// background. While the compositor is paused, we need to ensure that
|
||||
// no layer tree updates (from draw events) occur, since the compositor
|
||||
// cannot make a GL context current in order to process updates.
|
||||
if (window.mCompositorBridgeChild) {
|
||||
window.mCompositorBridgeChild->SendPause();
|
||||
}
|
||||
mCompositorPaused = true;
|
||||
}
|
||||
|
||||
void SyncPauseCompositor()
|
||||
{
|
||||
if (RefPtr<CompositorBridgeParent> bridge = window.GetCompositorBridgeParent()) {
|
||||
|
@ -1120,6 +1105,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
nsWindow::GeckoViewSupport::~GeckoViewSupport()
|
||||
{
|
||||
// Disassociate our GeckoEditable instance with our native object.
|
||||
|
@ -1133,7 +1119,7 @@ nsWindow::GeckoViewSupport::~GeckoViewSupport()
|
|||
nsWindow::GeckoViewSupport::Open(const jni::Class::LocalRef& aCls,
|
||||
GeckoView::Window::Param aWindow,
|
||||
GeckoView::Param aView,
|
||||
jni::Object::Param aGLController,
|
||||
jni::Object::Param aCompositor,
|
||||
jni::String::Param aChromeURI,
|
||||
int32_t aWidth, int32_t aHeight)
|
||||
{
|
||||
|
@ -1189,10 +1175,10 @@ nsWindow::GeckoViewSupport::Open(const jni::Class::LocalRef& aCls,
|
|||
|
||||
window->mGeckoViewSupport->mDOMWindow = pdomWindow;
|
||||
|
||||
// Attach the GLController to the new window.
|
||||
window->mGLControllerSupport = mozilla::MakeUnique<GLControllerSupport>(
|
||||
window, GLController::LocalRef(
|
||||
aCls.Env(), GLController::Ref::From(aGLController)));
|
||||
// Attach the Compositor to the new window.
|
||||
window->mLayerViewSupport = mozilla::MakeUnique<LayerViewSupport>(
|
||||
window, LayerView::Compositor::LocalRef(
|
||||
aCls.Env(), LayerView::Compositor::Ref::From(aCompositor)));
|
||||
|
||||
gGeckoViewWindow = window;
|
||||
|
||||
|
@ -1219,10 +1205,14 @@ nsWindow::GeckoViewSupport::Close()
|
|||
}
|
||||
|
||||
void
|
||||
nsWindow::GeckoViewSupport::Reattach(GeckoView::Param aView)
|
||||
nsWindow::GeckoViewSupport::Reattach(GeckoView::Param aView, jni::Object::Param aCompositor)
|
||||
{
|
||||
// Associate our previous GeckoEditable with the new GeckoView.
|
||||
mEditable->OnViewChange(aView);
|
||||
|
||||
window.mLayerViewSupport = mozilla::MakeUnique<LayerViewSupport>(
|
||||
&window, LayerView::Compositor::LocalRef(jni::GetGeckoThreadEnv(),
|
||||
LayerView::Compositor::Ref::From(aCompositor)));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1264,7 +1254,7 @@ nsWindow::InitNatives()
|
|||
{
|
||||
nsWindow::GeckoViewSupport::Base::Init();
|
||||
nsWindow::GeckoViewSupport::EditableBase::Init();
|
||||
nsWindow::GLControllerSupport::Init();
|
||||
nsWindow::LayerViewSupport::Init();
|
||||
nsWindow::NPZCSupport::Init();
|
||||
}
|
||||
|
||||
|
@ -1990,10 +1980,10 @@ nsWindow::GetNativeData(uint32_t aDataType)
|
|||
}
|
||||
|
||||
case NS_JAVA_SURFACE:
|
||||
if (!mGLControllerSupport) {
|
||||
if (!mLayerViewSupport) {
|
||||
return nullptr;
|
||||
}
|
||||
return mGLControllerSupport->GetSurface();
|
||||
return mLayerViewSupport->GetSurface();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -3518,8 +3508,8 @@ nsWindow::SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mGLControllerSupport);
|
||||
GeckoLayerClient::LocalRef client = mGLControllerSupport->GetLayerClient();
|
||||
MOZ_ASSERT(mLayerViewSupport);
|
||||
GeckoLayerClient::LocalRef client = mLayerViewSupport->GetLayerClient();
|
||||
client->SynthesizeNativeTouchPoint(aPointerId, eventType,
|
||||
aPoint.x, aPoint.y, aPointerPressure, aPointerOrientation);
|
||||
|
||||
|
@ -3534,8 +3524,8 @@ nsWindow::SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
|||
{
|
||||
mozilla::widget::AutoObserverNotifier notifier(aObserver, "mouseevent");
|
||||
|
||||
MOZ_ASSERT(mGLControllerSupport);
|
||||
GeckoLayerClient::LocalRef client = mGLControllerSupport->GetLayerClient();
|
||||
MOZ_ASSERT(mLayerViewSupport);
|
||||
GeckoLayerClient::LocalRef client = mLayerViewSupport->GetLayerClient();
|
||||
client->SynthesizeNativeMouseEvent(aNativeMessage, aPoint.x, aPoint.y);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -3547,8 +3537,8 @@ nsWindow::SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
|
|||
{
|
||||
mozilla::widget::AutoObserverNotifier notifier(aObserver, "mouseevent");
|
||||
|
||||
MOZ_ASSERT(mGLControllerSupport);
|
||||
GeckoLayerClient::LocalRef client = mGLControllerSupport->GetLayerClient();
|
||||
MOZ_ASSERT(mLayerViewSupport);
|
||||
GeckoLayerClient::LocalRef client = mLayerViewSupport->GetLayerClient();
|
||||
client->SynthesizeNativeMouseEvent(sdk::MotionEvent::ACTION_HOVER_MOVE, aPoint.x, aPoint.y);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -3561,8 +3551,8 @@ nsWindow::DrawWindowUnderlay(LayerManagerComposite* aManager,
|
|||
if (Destroyed()) {
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(mGLControllerSupport);
|
||||
GeckoLayerClient::LocalRef client = mGLControllerSupport->GetLayerClient();
|
||||
MOZ_ASSERT(mLayerViewSupport);
|
||||
GeckoLayerClient::LocalRef client = mLayerViewSupport->GetLayerClient();
|
||||
|
||||
LayerRenderer::Frame::LocalRef frame = client->CreateFrame();
|
||||
mLayerRendererFrame = frame;
|
||||
|
@ -3606,8 +3596,8 @@ nsWindow::DrawWindowOverlay(LayerManagerComposite* aManager,
|
|||
GLint scissorRect[4];
|
||||
gl->fGetIntegerv(LOCAL_GL_SCISSOR_BOX, scissorRect);
|
||||
|
||||
MOZ_ASSERT(mGLControllerSupport);
|
||||
GeckoLayerClient::LocalRef client = mGLControllerSupport->GetLayerClient();
|
||||
MOZ_ASSERT(mLayerViewSupport);
|
||||
GeckoLayerClient::LocalRef client = mLayerViewSupport->GetLayerClient();
|
||||
|
||||
client->ActivateProgram();
|
||||
mLayerRendererFrame->DrawForeground();
|
||||
|
@ -3622,8 +3612,8 @@ nsWindow::DrawWindowOverlay(LayerManagerComposite* aManager,
|
|||
void
|
||||
nsWindow::InvalidateAndScheduleComposite()
|
||||
{
|
||||
if (gGeckoViewWindow && gGeckoViewWindow->mGLControllerSupport) {
|
||||
gGeckoViewWindow->mGLControllerSupport->
|
||||
if (gGeckoViewWindow && gGeckoViewWindow->mLayerViewSupport) {
|
||||
gGeckoViewWindow->mLayerViewSupport->
|
||||
SyncInvalidateAndScheduleComposite();
|
||||
}
|
||||
}
|
||||
|
@ -3631,8 +3621,8 @@ nsWindow::InvalidateAndScheduleComposite()
|
|||
bool
|
||||
nsWindow::IsCompositionPaused()
|
||||
{
|
||||
if (gGeckoViewWindow && gGeckoViewWindow->mGLControllerSupport) {
|
||||
return gGeckoViewWindow->mGLControllerSupport->CompositorPaused();
|
||||
if (gGeckoViewWindow && gGeckoViewWindow->mLayerViewSupport) {
|
||||
return gGeckoViewWindow->mLayerViewSupport->CompositorPaused();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -3640,16 +3630,16 @@ nsWindow::IsCompositionPaused()
|
|||
void
|
||||
nsWindow::SchedulePauseComposition()
|
||||
{
|
||||
if (gGeckoViewWindow && gGeckoViewWindow->mGLControllerSupport) {
|
||||
return gGeckoViewWindow->mGLControllerSupport->SyncPauseCompositor();
|
||||
if (gGeckoViewWindow && gGeckoViewWindow->mLayerViewSupport) {
|
||||
return gGeckoViewWindow->mLayerViewSupport->SyncPauseCompositor();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsWindow::ScheduleResumeComposition()
|
||||
{
|
||||
if (gGeckoViewWindow && gGeckoViewWindow->mGLControllerSupport) {
|
||||
return gGeckoViewWindow->mGLControllerSupport->SyncResumeCompositor();
|
||||
if (gGeckoViewWindow && gGeckoViewWindow->mLayerViewSupport) {
|
||||
return gGeckoViewWindow->mLayerViewSupport->SyncResumeCompositor();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3684,7 +3674,7 @@ nsWindow::WidgetPaintsBackground()
|
|||
bool
|
||||
nsWindow::NeedsPaint()
|
||||
{
|
||||
if (!mGLControllerSupport || mGLControllerSupport->CompositorPaused() ||
|
||||
if (!mLayerViewSupport || mLayerViewSupport->CompositorPaused() ||
|
||||
// FindTopLevel() != nsWindow::TopWindow() ||
|
||||
!GetLayerManager(nullptr)) {
|
||||
return false;
|
||||
|
|
|
@ -59,9 +59,8 @@ private:
|
|||
// nullptr for nsWindows that were not opened from GeckoView.
|
||||
mozilla::UniquePtr<GeckoViewSupport> mGeckoViewSupport;
|
||||
|
||||
class GLControllerSupport;
|
||||
// Object that implements native GLController calls.
|
||||
mozilla::UniquePtr<GLControllerSupport> mGLControllerSupport;
|
||||
class LayerViewSupport;
|
||||
mozilla::UniquePtr<LayerViewSupport> mLayerViewSupport;
|
||||
|
||||
class NPZCSupport;
|
||||
// Object that implements native NativePanZoomController calls.
|
||||
|
|
Загрузка…
Ссылка в новой задаче