summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2011-03-17 10:31:57 -0700
committerNicolas Roard <nicolasroard@google.com>2011-03-17 10:38:52 -0700
commit439cfed476441572caa4206a622e3ef3c188798b (patch)
tree631463d8527b7db32c6e90a331f6e226920fa9d4 /WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp
parent9f5143f9ae49a8e5fdb7ea626c4efad66096b020 (diff)
downloadexternal_webkit-439cfed476441572caa4206a622e3ef3c188798b.zip
external_webkit-439cfed476441572caa4206a622e3ef3c188798b.tar.gz
external_webkit-439cfed476441572caa4206a622e3ef3c188798b.tar.bz2
Fix Browser ANR
The problem was that when attempting to forcefully destroy a texture in TilesManager::cleanupLayersTextures(), the call to LayerAndroid::removeTexture() may fail if the texture was busy being painted -- the call to BackedDoubleBufferedTexture::release() would return false, and the layer may thus still keep a pointer to the texture. But the release() call, while indicating it failed, was only delaying the release -- as soon as the texture was marked as not busy, it could set its owner to nil. We could thus have a situation where the layer did not reset its texture pointers because the owner of the texture was not yet changed, but the texture would then reset its owner to nil as soon as it was not busy painting. In TilesManager::cleanupLayersTexture() the next step before deleting a texture is to check that the texture does not have an owner -- but by then the texture could have been marked as not busy, and removed its owner, letting TilesManager destroying it. bug:3472320 Change-Id: I3bcf169b30dfacba1773d3b79a3c0d205bf3cbdb
Diffstat (limited to 'WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp')
-rw-r--r--WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp
index 470ecf1..f68050f 100644
--- a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp
+++ b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp
@@ -228,16 +228,16 @@ bool BackedDoubleBufferedTexture::setOwner(TextureOwner* owner)
bool BackedDoubleBufferedTexture::release(TextureOwner* owner)
{
android::Mutex::Autolock lock(m_busyLock);
- if (m_owner == owner) {
- if (!m_busy) {
- m_owner = 0;
- return true;
- } else {
- m_delayedRelease = true;
- m_delayedReleaseOwner = owner;
- }
+ if (m_owner != owner)
+ return false;
+
+ if (!m_busy) {
+ m_owner = 0;
+ } else {
+ m_delayedRelease = true;
+ m_delayedReleaseOwner = owner;
}
- return false;
+ return true;
}
void BackedDoubleBufferedTexture::setTile(TextureInfo* info, int x, int y,