diff options
author | Jonathan Dixon <joth@google.com> | 2012-03-05 19:43:05 +0000 |
---|---|---|
committer | Jonathan Dixon <joth@google.com> | 2012-03-21 07:59:14 +0000 |
commit | 1acf6173ad2e607642c57cf7572354df1f2f3fa8 (patch) | |
tree | 101ab2266b40c49b2e8136a68d2f004486525343 /Source/WebCore/platform/graphics | |
parent | d77fa7bfea2cf8a2d29b5f3d994b45a270443a51 (diff) | |
download | external_webkit-1acf6173ad2e607642c57cf7572354df1f2f3fa8.zip external_webkit-1acf6173ad2e607642c57cf7572354df1f2f3fa8.tar.gz external_webkit-1acf6173ad2e607642c57cf7572354df1f2f3fa8.tar.bz2 |
Plumb WebView and WebViewCore thru to MediaLayer
Depends on https://android-git.corp.google.com/g/171224
Changes the plugin code to provide the WebView (not WebViewClassic) jobject
instance into the plugin, as this provides the full public API expected.
As a knock-on, I had to plumb WebViewCore jobject through to MediaTexture
so it can retain the sendPluginDrawMsg() call. This isn't pretty, but in
terms of layering it's no worse than before.
Change-Id: Iaaa6e0c6b65963fedaff078a20477d8595c82a5d
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; |