Bug 769269 - Update the graphics code to be able to deal with blowing away the layer controller, client, and view and creating them afresh. r=ajuma

This commit is contained in:
Kartikaya Gupta
2012-07-13 10:19:46 -04:00
parent 39bd6f462c
commit dbe3816e67
8 changed files with 59 additions and 10 deletions

View File

@@ -24,6 +24,7 @@ void AndroidEGLObject::Init(JNIEnv* aJEnv) {
jmethodID AndroidGLController::jSetGLVersionMethod = 0;
jmethodID AndroidGLController::jWaitForValidSurfaceMethod = 0;
jmethodID AndroidGLController::jProvideEGLSurfaceMethod = 0;
jmethodID AndroidGLController::jResumeCompositorIfValidMethod = 0;
void
AndroidGLController::Init(JNIEnv* aJEnv)
@@ -33,6 +34,7 @@ AndroidGLController::Init(JNIEnv* aJEnv)
jSetGLVersionMethod = aJEnv->GetMethodID(jClass, "setGLVersion", "(I)V");
jProvideEGLSurfaceMethod = aJEnv->GetMethodID(jClass, "provideEGLSurface",
"()Ljavax/microedition/khronos/egl/EGLSurface;");
jResumeCompositorIfValidMethod = aJEnv->GetMethodID(jClass, "resumeCompositorIfValid", "()V");
jWaitForValidSurfaceMethod = aJEnv->GetMethodID(jClass, "waitForValidSurface", "()V");
}
@@ -52,6 +54,16 @@ AndroidGLController::SetGLVersion(int aVersion)
mJEnv->CallVoidMethod(mJObj, jSetGLVersionMethod, aVersion);
}
void
AndroidGLController::Reacquire(JNIEnv *aJEnv, jobject aJObj)
{
aJEnv->DeleteGlobalRef(mJObj);
mJObj = aJEnv->NewGlobalRef(aJObj);
AutoLocalJNIFrame jniFrame(aJEnv, 0);
aJEnv->CallVoidMethod(mJObj, jResumeCompositorIfValidMethod);
}
EGLSurface
AndroidGLController::ProvideEGLSurface()
{