diff options
Diffstat (limited to 'Source/WebCore/platform/graphics')
4 files changed, 18 insertions, 21 deletions
diff --git a/Source/WebCore/platform/graphics/android/MediaLayer.cpp b/Source/WebCore/platform/graphics/android/MediaLayer.cpp index de1db17..6227ea4 100644 --- a/Source/WebCore/platform/graphics/android/MediaLayer.cpp +++ b/Source/WebCore/platform/graphics/android/MediaLayer.cpp @@ -28,9 +28,9 @@ namespace WebCore { -MediaLayer::MediaLayer(jobject webViewRef) : LayerAndroid((RenderLayer*) NULL) +MediaLayer::MediaLayer(jobject webViewRef, jobject webViewCoreRef) : LayerAndroid((RenderLayer*) NULL) { - m_mediaTexture = new MediaTexture(webViewRef); + m_mediaTexture = new MediaTexture(webViewRef, webViewCoreRef); m_mediaTexture->incStrong(this); m_isCopy = false; diff --git a/Source/WebCore/platform/graphics/android/MediaLayer.h b/Source/WebCore/platform/graphics/android/MediaLayer.h index 907c53c..2f39d74 100644 --- a/Source/WebCore/platform/graphics/android/MediaLayer.h +++ b/Source/WebCore/platform/graphics/android/MediaLayer.h @@ -32,7 +32,7 @@ namespace WebCore { class MediaLayer : public LayerAndroid { public: - MediaLayer(jobject webViewRef); + MediaLayer(jobject webViewRef, jobject webViewCoreRef); MediaLayer(const MediaLayer& layer); virtual ~MediaLayer(); diff --git a/Source/WebCore/platform/graphics/android/MediaTexture.cpp b/Source/WebCore/platform/graphics/android/MediaTexture.cpp index 789ca03..faa20a1 100644 --- a/Source/WebCore/platform/graphics/android/MediaTexture.cpp +++ b/Source/WebCore/platform/graphics/android/MediaTexture.cpp @@ -41,14 +41,11 @@ namespace WebCore { -MediaTexture::MediaTexture(jobject webViewRef) : android::LightRefBase<MediaTexture>() +MediaTexture::MediaTexture(jobject webViewRef, jobject webViewCoreRef) : android::LightRefBase<MediaTexture>() { - if (webViewRef) { - JNIEnv* env = JSC::Bindings::getJNIEnv(); - m_weakWebViewRef = env->NewWeakGlobalRef(webViewRef); - } else { - m_weakWebViewRef = 0; - } + JNIEnv* env = JSC::Bindings::getJNIEnv(); + m_weakWebViewRef = env->NewWeakGlobalRef(webViewRef); + m_weakWebViewCoreRef = env->NewWeakGlobalRef(webViewCoreRef); m_contentTexture = 0; m_isContentInverted = false; @@ -63,10 +60,9 @@ MediaTexture::~MediaTexture() deleteTexture(m_videoTextures[i], true); } - if (m_weakWebViewRef) { - JNIEnv* env = JSC::Bindings::getJNIEnv(); - env->DeleteWeakGlobalRef(m_weakWebViewRef); - } + JNIEnv* env = JSC::Bindings::getJNIEnv(); + env->DeleteWeakGlobalRef(m_weakWebViewRef); + env->DeleteWeakGlobalRef(m_weakWebViewCoreRef); } bool MediaTexture::isContentInverted() @@ -98,16 +94,16 @@ void MediaTexture::initNativeWindowIfNeeded() m_contentTexture = createTexture(); // send a message to the WebKit thread to notify the plugin that it can draw - if (m_weakWebViewRef) { + if (m_weakWebViewCoreRef) { JNIEnv* env = JSC::Bindings::getJNIEnv(); - jobject localWebViewRef = env->NewLocalRef(m_weakWebViewRef); - if (localWebViewRef) { - jclass wvClass = env->GetObjectClass(localWebViewRef); + jobject localWebViewCoreRef = env->NewLocalRef(m_weakWebViewCoreRef); + if (localWebViewCoreRef) { + jclass wvClass = env->GetObjectClass(localWebViewCoreRef); jmethodID sendPluginDrawMsg = env->GetMethodID(wvClass, "sendPluginDrawMsg", "()V"); - env->CallVoidMethod(localWebViewRef, sendPluginDrawMsg); + env->CallVoidMethod(localWebViewCoreRef, sendPluginDrawMsg); env->DeleteLocalRef(wvClass); - env->DeleteLocalRef(localWebViewRef); + env->DeleteLocalRef(localWebViewCoreRef); } checkException(env); } diff --git a/Source/WebCore/platform/graphics/android/MediaTexture.h b/Source/WebCore/platform/graphics/android/MediaTexture.h index 97bb530..9ea7be2 100644 --- a/Source/WebCore/platform/graphics/android/MediaTexture.h +++ b/Source/WebCore/platform/graphics/android/MediaTexture.h @@ -40,7 +40,7 @@ class MediaListener; class MediaTexture : public android::LightRefBase<MediaTexture> { public: - MediaTexture(jobject webViewRef); + MediaTexture(jobject webViewRef, jobject webViewCoreRef); ~MediaTexture(); bool isContentInverted(); @@ -83,6 +83,7 @@ private: sp<ANativeWindow> m_newWindow; jobject m_weakWebViewRef; + jobject m_weakWebViewCoreRef; android::Mutex m_mediaLock; android::Condition m_newMediaRequestCond; |