summaryrefslogtreecommitdiffstats
path: root/WebCore
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2011-03-25 10:39:24 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-03-25 10:39:24 -0700
commit78eb447490d235178fafa5bd046918ffe965003f (patch)
tree6e68917620df64974a08716b7bca3204fe3e819d /WebCore
parent69627397d7754f6951d1d6764a7ae20df4bd0e2b (diff)
parent8527f14d378e1fb4ba315d791f3c8c7b776bff4c (diff)
downloadexternal_webkit-78eb447490d235178fafa5bd046918ffe965003f.zip
external_webkit-78eb447490d235178fafa5bd046918ffe965003f.tar.gz
external_webkit-78eb447490d235178fafa5bd046918ffe965003f.tar.bz2
am 8527f14d: am 92c3acf6: Fix error where mediaLayer is derefed on UI thread prior to being derefed in Webkit.
* commit '8527f14d378e1fb4ba315d791f3c8c7b776bff4c': Fix error where mediaLayer is derefed on UI thread prior to being derefed in Webkit.
Diffstat (limited to 'WebCore')
-rw-r--r--WebCore/platform/graphics/android/DoubleBufferedTexture.cpp12
-rw-r--r--WebCore/platform/graphics/android/DoubleBufferedTexture.h1
-rw-r--r--WebCore/platform/graphics/android/MediaTexture.cpp12
-rw-r--r--WebCore/platform/graphics/android/SharedTexture.cpp13
-rw-r--r--WebCore/platform/graphics/android/SharedTexture.h1
5 files changed, 30 insertions, 9 deletions
diff --git a/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp b/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp
index cf640e8..395bb2b 100644
--- a/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp
+++ b/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp
@@ -114,6 +114,18 @@ void DoubleBufferedTexture::producerDeleteTextures()
m_textureB.unlock();
}
+void DoubleBufferedTexture::consumerDeleteTextures()
+{
+ m_textureA.lock();
+ m_textureB.lock();
+ LOGV("Deleting Consumer Textures A/B (%d:%d)", m_textureA.getTargetTextureId(),
+ m_textureB.getTargetTextureId());
+ m_textureA.deleteTargetTexture();
+ m_textureB.deleteTargetTexture();
+ m_textureA.unlock();
+ m_textureB.unlock();
+}
+
TextureInfo* DoubleBufferedTexture::producerLock()
{
SharedTexture* sharedTex = getWriteableTexture();
diff --git a/WebCore/platform/graphics/android/DoubleBufferedTexture.h b/WebCore/platform/graphics/android/DoubleBufferedTexture.h
index 8a9d81e..ba56c0e 100644
--- a/WebCore/platform/graphics/android/DoubleBufferedTexture.h
+++ b/WebCore/platform/graphics/android/DoubleBufferedTexture.h
@@ -47,6 +47,7 @@ public:
// consumer thread functions
TextureInfo* consumerLock();
void consumerRelease();
+ void consumerDeleteTextures();
protected:
SharedTexture* getReadableTexture();
diff --git a/WebCore/platform/graphics/android/MediaTexture.cpp b/WebCore/platform/graphics/android/MediaTexture.cpp
index 9821065..14f0c20 100644
--- a/WebCore/platform/graphics/android/MediaTexture.cpp
+++ b/WebCore/platform/graphics/android/MediaTexture.cpp
@@ -104,8 +104,9 @@ void MediaTexture::consumerInc()
/* Decrement the number of objects in the consumer's thread that are holding a
* reference to this object. When removing the last reference we must delete
* this object and by extension cleanup all GL objects that are associated with
- * the consumer's thread. At the time of deletion there should be no remaining
- * producer references.
+ * the consumer's thread. At the time of deletion if there is a remaining
+ * producer reference we must cleanup the consumer GL objects in the event that
+ * this texture will not be re-synced with the UI thread.
*/
void MediaTexture::consumerDec()
{
@@ -114,9 +115,10 @@ void MediaTexture::consumerDec()
m_mediaLock.lock();
m_consumerRefCount--;
if (m_consumerRefCount == 0) {
- needsDeleted = true;
- if (m_producerRefCount != 0) {
- XLOG("ERROR: We should not delete the consumer before the producer is finished");
+ consumerDeleteTextures();
+ if (m_producerRefCount < 1) {
+ XLOG("WARNING: This texture still exists within webkit.");
+ needsDeleted = true;
}
}
m_mediaLock.unlock();
diff --git a/WebCore/platform/graphics/android/SharedTexture.cpp b/WebCore/platform/graphics/android/SharedTexture.cpp
index 8c703d4..495fdd0 100644
--- a/WebCore/platform/graphics/android/SharedTexture.cpp
+++ b/WebCore/platform/graphics/android/SharedTexture.cpp
@@ -80,10 +80,7 @@ SharedTexture::SharedTexture()
// source texture and EGLImage is the responsibility of the caller.
SharedTexture::~SharedTexture()
{
- if (m_supportsEGLImage)
- GLUtils::deleteTexture(&m_targetTexture.m_textureId);
- else
- GLUtils::deleteTexture(&m_sourceTexture.m_textureId);
+ deleteTargetTexture();
}
void SharedTexture::initSourceTexture()
@@ -120,6 +117,14 @@ void SharedTexture::deleteSourceTexture()
}
}
+void SharedTexture::deleteTargetTexture()
+{
+ if (m_supportsEGLImage)
+ GLUtils::deleteTexture(&m_targetTexture.m_textureId);
+ else
+ GLUtils::deleteTexture(&m_sourceTexture.m_textureId);
+}
+
TextureInfo* SharedTexture::lockSource()
{
m_lock.lock();
diff --git a/WebCore/platform/graphics/android/SharedTexture.h b/WebCore/platform/graphics/android/SharedTexture.h
index 731aa5c..37d6091 100644
--- a/WebCore/platform/graphics/android/SharedTexture.h
+++ b/WebCore/platform/graphics/android/SharedTexture.h
@@ -81,6 +81,7 @@ public:
void initSourceTexture(); // producer thread only
void deleteSourceTexture(); // producer thread only
+ void deleteTargetTexture(); // consumer thread only
GLuint getSourceTextureId() { return m_sourceTexture.m_textureId; }
GLuint getTargetTextureId() { return m_targetTexture.m_textureId; }
EGLImageKHR getEGLImage() { return m_eglImage; }