зеркало из https://github.com/mozilla/pjs.git
Move registerCxxCompositor to FlexView
This commit is contained in:
Родитель
75e154812c
Коммит
4e100d2bce
|
@ -133,7 +133,6 @@ FENNEC_JAVA_FILES = \
|
||||||
gfx/TileLayer.java \
|
gfx/TileLayer.java \
|
||||||
gfx/ViewportMetrics.java \
|
gfx/ViewportMetrics.java \
|
||||||
gfx/WidgetTileLayer.java \
|
gfx/WidgetTileLayer.java \
|
||||||
gfx/layers/OGLSurfaceView.java \
|
|
||||||
ui/Axis.java \
|
ui/Axis.java \
|
||||||
ui/PanZoomController.java \
|
ui/PanZoomController.java \
|
||||||
ui/SimpleScaleGestureDetector.java \
|
ui/SimpleScaleGestureDetector.java \
|
||||||
|
|
|
@ -153,6 +153,40 @@ public class FlexibleGLSurfaceView extends SurfaceView implements SurfaceHolder.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called from the compositor thread
|
||||||
|
public static GLController registerCxxCompositor() {
|
||||||
|
System.out.println("register layer comp");
|
||||||
|
/*
|
||||||
|
synchronized (FlexibleGLSurfaceView.class) {
|
||||||
|
// Wait for the layer controller if by some miracle
|
||||||
|
// gecko beats the java thread here.
|
||||||
|
while (mLayerController == null) {
|
||||||
|
try {
|
||||||
|
OGLSurfaceView.class.wait();
|
||||||
|
} catch (InterruptedException e) {}
|
||||||
|
}
|
||||||
|
final LayerController controller = mLayerController;
|
||||||
|
|
||||||
|
GeckoApp.mAppContext.runOnUiThread(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
synchronized (OGLSurfaceView.class) {
|
||||||
|
OGLSurfaceView surfaceView =
|
||||||
|
new OGLSurfaceView(controller.getContext(), controller);
|
||||||
|
OGLSurfaceView.class.notifyAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Wait for the compositor to be setup on the
|
||||||
|
// Java UI thread.
|
||||||
|
try {
|
||||||
|
OGLSurfaceView.class.wait();
|
||||||
|
} catch (InterruptedException e) {}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static class FlexibleGLSurfaceViewException extends RuntimeException {
|
public static class FlexibleGLSurfaceViewException extends RuntimeException {
|
||||||
public static final long serialVersionUID = 1L;
|
public static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ AndroidBridge::Init(JNIEnv *jEnv,
|
||||||
jEGLConfigImplClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("com/google/android/gles_jni/EGLConfigImpl"));
|
jEGLConfigImplClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("com/google/android/gles_jni/EGLConfigImpl"));
|
||||||
jEGLDisplayImplClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("com/google/android/gles_jni/EGLDisplayImpl"));
|
jEGLDisplayImplClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("com/google/android/gles_jni/EGLDisplayImpl"));
|
||||||
|
|
||||||
jOGLSurfaceView = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("org/mozilla/gecko/gfx/layers/OGLSurfaceView"));
|
jFlexSurfaceView = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("org/mozilla/gecko/gfx/FlexibleGLSurfaceView"));
|
||||||
|
|
||||||
InitAndroidJavaWrappers(jEnv);
|
InitAndroidJavaWrappers(jEnv);
|
||||||
|
|
||||||
|
@ -1024,11 +1024,14 @@ void
|
||||||
AndroidBridge::RegisterCompositor()
|
AndroidBridge::RegisterCompositor()
|
||||||
{
|
{
|
||||||
ALOG_BRIDGE("AndroidBridge::RegisterCompositor");
|
ALOG_BRIDGE("AndroidBridge::RegisterCompositor");
|
||||||
AutoLocalJNIFrame jniFrame(GetJNIForThread());
|
JNIEnv *env = GetJNIForThread();
|
||||||
|
if (!env)
|
||||||
|
return;
|
||||||
|
|
||||||
jmethodID registerCompositor = GetJNIForThread()->GetStaticMethodID(jOGLSurfaceView, "registerCompositor", "()V");
|
AutoLocalJNIFrame jniFrame(env, 3);
|
||||||
|
jmethodID registerCompositor = env->GetStaticMethodID(jFlexSurfaceView, "registerCxxCompositor", "()Lorg/mozilla/gecko/gfx/GLController;");
|
||||||
|
|
||||||
GetJNIForThread()->CallStaticVoidMethod(jOGLSurfaceView, registerCompositor);
|
jobject glController = env->CallStaticObjectMethod(jFlexSurfaceView, registerCompositor);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -486,7 +486,7 @@ protected:
|
||||||
jclass jEGLContextClass;
|
jclass jEGLContextClass;
|
||||||
jclass jEGL10Class;
|
jclass jEGL10Class;
|
||||||
|
|
||||||
jclass jOGLSurfaceView;
|
jclass jFlexSurfaceView;
|
||||||
|
|
||||||
// calls we've dlopened from libjnigraphics.so
|
// calls we've dlopened from libjnigraphics.so
|
||||||
int (* AndroidBitmap_getInfo)(JNIEnv *env, jobject bitmap, void *info);
|
int (* AndroidBitmap_getInfo)(JNIEnv *env, jobject bitmap, void *info);
|
||||||
|
|
|
@ -108,7 +108,6 @@ extern "C" {
|
||||||
NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_bindWidgetTexture(JNIEnv* jenv, jclass);
|
NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_bindWidgetTexture(JNIEnv* jenv, jclass);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NS_EXPORT void JNICALL Java_org_mozilla_gfx_layers_OGLSurfaceView_setSurfaceView(JNIEnv *jenv, jclass, jobject sv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,12 +143,6 @@ Java_org_mozilla_gecko_GeckoAppShell_setSurfaceView(JNIEnv *jenv, jclass, jobjec
|
||||||
AndroidBridge::Bridge()->SetSurfaceView(jenv->NewGlobalRef(obj));
|
AndroidBridge::Bridge()->SetSurfaceView(jenv->NewGlobalRef(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_EXPORT void JNICALL
|
|
||||||
Java_org_mozilla_gfx_layers_OGLSurfaceView_setSurfaceView(JNIEnv *jenv, jclass, jobject obj)
|
|
||||||
{
|
|
||||||
AndroidBridge::Bridge()->SetSurfaceView(jenv->NewGlobalRef(obj));
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_EXPORT void JNICALL
|
NS_EXPORT void JNICALL
|
||||||
Java_org_mozilla_gecko_GeckoAppShell_setSoftwareLayerClient(JNIEnv *jenv, jclass, jobject obj)
|
Java_org_mozilla_gecko_GeckoAppShell_setSoftwareLayerClient(JNIEnv *jenv, jclass, jobject obj)
|
||||||
{
|
{
|
||||||
|
|
|
@ -770,6 +770,14 @@ nsWindow::GetLayerManager(PLayersChild*, LayersBackend, LayerManagerPersistence,
|
||||||
return mLayerManager;
|
return mLayerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool useCompositor =
|
||||||
|
Preferences::GetBool("layers.offmainthreadcomposition.enabled", false);
|
||||||
|
|
||||||
|
if (useCompositor) {
|
||||||
|
CreateCompositor();
|
||||||
|
sFailedToCreateGLContext = !mLayerManager;
|
||||||
|
}
|
||||||
|
|
||||||
mUseAcceleratedRendering = GetShouldAccelerate();
|
mUseAcceleratedRendering = GetShouldAccelerate();
|
||||||
|
|
||||||
if (!mUseAcceleratedRendering ||
|
if (!mUseAcceleratedRendering ||
|
||||||
|
@ -780,13 +788,6 @@ nsWindow::GetLayerManager(PLayersChild*, LayersBackend, LayerManagerPersistence,
|
||||||
return mLayerManager;
|
return mLayerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool useCompositor =
|
|
||||||
Preferences::GetBool("layers.offmainthreadcomposition.enabled", false);
|
|
||||||
|
|
||||||
if (useCompositor) {
|
|
||||||
CreateCompositor();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mLayerManager) {
|
if (!mLayerManager) {
|
||||||
if (!sGLContext) {
|
if (!sGLContext) {
|
||||||
// the window we give doesn't matter here
|
// the window we give doesn't matter here
|
||||||
|
|
Загрузка…
Ссылка в новой задаче