summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp2
-rw-r--r--WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h4
-rw-r--r--WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp7
3 files changed, 8 insertions, 5 deletions
diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index ba9f295..72aefa4 100644
--- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -852,9 +852,9 @@ void GraphicsLayerAndroid::setContentsToMedia(PlatformLayer* mediaLayer)
mediaLayer->setSize(m_contentLayer->getWidth(), m_contentLayer->getHeight());
mediaLayer->setDrawTransform(m_contentLayer->drawTransform());
+ mediaLayer->ref();
m_contentLayer->unref();
m_contentLayer = mediaLayer;
- m_contentLayer->ref();
// If the parent exists then notify it to re-sync it's children
if (m_parent) {
diff --git a/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h b/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h
index d10e1ff..66b35dd 100644
--- a/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h
+++ b/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h
@@ -99,7 +99,7 @@ public:
bool supportsAcceleratedRendering() const { return true; }
LayerAndroid* platformLayer() const
{
- return const_cast<VideoLayerAndroid*> (&m_videoLayer);
+ return m_videoLayer;
}
protected:
@@ -131,7 +131,7 @@ protected:
bool m_naturalSizeUnknown;
bool m_isVisible;
- VideoLayerAndroid m_videoLayer;
+ VideoLayerAndroid* m_videoLayer;
};
} // namespace WebCore
diff --git a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
index 2203ae2..e628ea1 100644
--- a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
@@ -72,6 +72,8 @@ struct MediaPlayerPrivate::JavaGlue {
MediaPlayerPrivate::~MediaPlayerPrivate()
{
+ // m_videoLayer is reference counted, unref is enough here.
+ m_videoLayer->unref();
if (m_glue->m_javaProxy) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (env) {
@@ -150,7 +152,8 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
m_poster(0),
m_naturalSize(100, 100),
m_naturalSizeUnknown(true),
- m_isVisible(false)
+ m_isVisible(false),
+ m_videoLayer(new VideoLayerAndroid())
{
}
@@ -211,7 +214,7 @@ public:
jstring jUrl = wtfStringToJstring(env, m_url);
env->CallVoidMethod(m_glue->m_javaProxy, m_glue->m_play, jUrl,
static_cast<jint>(m_currentTime * 1000.0f),
- m_videoLayer.uniqueId());
+ m_videoLayer->uniqueId());
env->DeleteLocalRef(jUrl);
checkException(env);