OSDN Git Service

Fix to post an inval when plugins request a native video surface.
authorDerek Sollenberger <djsollen@google.com>
Sat, 5 Feb 2011 13:38:03 +0000 (08:38 -0500)
committerDerek Sollenberger <djsollen@google.com>
Sat, 5 Feb 2011 13:38:03 +0000 (08:38 -0500)
Change-Id: If9295a37ae19e7cb913e4cfa75b2a021bcda988f

WebCore/platform/graphics/android/MediaTexture.cpp

index c994e78..a92b570 100644 (file)
@@ -158,8 +158,23 @@ ANativeWindow* VideoTexture::requestNewWindow()
     }
 
     m_newWindowRequest = true;
+
+    // post an inval message to the UI thread to fulfill the request
+    if (m_weakWebViewRef) {
+        JNIEnv* env = JSC::Bindings::getJNIEnv();
+        jobject localWebViewRef = env->NewLocalRef(m_weakWebViewRef);
+        if (localWebViewRef) {
+            jclass wvClass = env->GetObjectClass(localWebViewRef);
+            jmethodID postInvalMethod = env->GetMethodID(wvClass, "postInvalidate", "()V");
+            env->CallVoidMethod(localWebViewRef, postInvalMethod);
+            env->DeleteLocalRef(wvClass);
+            env->DeleteLocalRef(localWebViewRef);
+        }
+        checkException(env);
+    }
+
     //block until the request can be fulfilled or we time out
-    m_newVideoRequestCond.waitRelative(m_videoLock, 1000000000); // 1 sec
+    m_newVideoRequestCond.waitRelative(m_videoLock, 500000000); // .5 sec
 
     if (m_surfaceTextureClient.get())
         m_newWindowReady = false;