diff options
author | Derek Sollenberger <djsollen@google.com> | 2011-08-29 13:51:19 -0400 |
---|---|---|
committer | Derek Sollenberger <djsollen@google.com> | 2011-08-29 13:51:19 -0400 |
commit | b259cb234d9c7a05f3eb9fb20a035dfc7bca0544 (patch) | |
tree | 363d44e214754c6b98e613676057ee4f177b3ebe /Source/WebCore/platform | |
parent | a53530faedfcc88c00b455e71bb3e2b738529e6a (diff) | |
download | external_webkit-b259cb234d9c7a05f3eb9fb20a035dfc7bca0544.zip external_webkit-b259cb234d9c7a05f3eb9fb20a035dfc7bca0544.tar.gz external_webkit-b259cb234d9c7a05f3eb9fb20a035dfc7bca0544.tar.bz2 |
Fix plugin crashes due to bad ref counting.
bug: 5197948
Change-Id: Iece573a141feda56af2123b5fc9ace4cefa5139d
Diffstat (limited to 'Source/WebCore/platform')
4 files changed, 13 insertions, 7 deletions
diff --git a/Source/WebCore/platform/graphics/android/MediaLayer.cpp b/Source/WebCore/platform/graphics/android/MediaLayer.cpp index ae65173..5625bbe 100644 --- a/Source/WebCore/platform/graphics/android/MediaLayer.cpp +++ b/Source/WebCore/platform/graphics/android/MediaLayer.cpp @@ -40,11 +40,11 @@ namespace WebCore { -MediaLayer::MediaLayer(jobject weakWebViewRef) : LayerAndroid((RenderLayer*) NULL) +MediaLayer::MediaLayer(jobject webViewRef) : LayerAndroid((RenderLayer*) NULL) { - m_contentTexture = new MediaTexture(weakWebViewRef); + m_contentTexture = new MediaTexture(webViewRef); m_contentTexture->incStrong(this); - m_videoTexture = new MediaTexture(weakWebViewRef); + m_videoTexture = new MediaTexture(webViewRef); m_videoTexture->incStrong(this); m_isCopy = false; diff --git a/Source/WebCore/platform/graphics/android/MediaLayer.h b/Source/WebCore/platform/graphics/android/MediaLayer.h index dd58674..6d08ed6 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 weakWebViewRef); + MediaLayer(jobject webViewRef); 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 96d136a..eb143a4 100644 --- a/Source/WebCore/platform/graphics/android/MediaTexture.cpp +++ b/Source/WebCore/platform/graphics/android/MediaTexture.cpp @@ -48,9 +48,15 @@ namespace WebCore { -MediaTexture::MediaTexture(jobject weakWebViewRef) : android::LightRefBase<MediaTexture>() +MediaTexture::MediaTexture(jobject webViewRef) : android::LightRefBase<MediaTexture>() { - m_weakWebViewRef = weakWebViewRef; + if (webViewRef) { + JNIEnv* env = JSC::Bindings::getJNIEnv(); + m_weakWebViewRef = env->NewWeakGlobalRef(webViewRef); + } else { + m_weakWebViewRef = 0; + } + m_textureId = 0; m_dimensions.setEmpty(); m_newWindowRequest = false; diff --git a/Source/WebCore/platform/graphics/android/MediaTexture.h b/Source/WebCore/platform/graphics/android/MediaTexture.h index d7ae9cb..c617264 100644 --- a/Source/WebCore/platform/graphics/android/MediaTexture.h +++ b/Source/WebCore/platform/graphics/android/MediaTexture.h @@ -36,7 +36,7 @@ class MediaListener; class MediaTexture : public android::LightRefBase<MediaTexture> { public: - MediaTexture(jobject weakWebViewRef); + MediaTexture(jobject webViewRef); ~MediaTexture(); void initNativeWindowIfNeeded(); |