diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2010-12-15 09:30:05 -0800 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2010-12-15 17:29:13 -0800 |
commit | 0bdd7f2d73cad03535071e5de0ba3d2f5feb1b00 (patch) | |
tree | 7ce1ef405819e1f545530c45a645854295007b01 /WebCore/platform/graphics/android | |
parent | 74427af10b1794f0e99b7e7a451c4a40902c98f4 (diff) | |
download | external_webkit-0bdd7f2d73cad03535071e5de0ba3d2f5feb1b00.zip external_webkit-0bdd7f2d73cad03535071e5de0ba3d2f5feb1b00.tar.gz external_webkit-0bdd7f2d73cad03535071e5de0ba3d2f5feb1b00.tar.bz2 |
Better thread safety protection on m_usable
m_usable is written in the thread of texture painting, it should
be better protected.
bug: 3215000
Change-Id: I5b1a5eaa4e469b6e5c840cd7299a1d955780729a
Diffstat (limited to 'WebCore/platform/graphics/android')
-rw-r--r-- | WebCore/platform/graphics/android/BaseTile.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/WebCore/platform/graphics/android/BaseTile.cpp b/WebCore/platform/graphics/android/BaseTile.cpp index 5701486..789cbe0 100644 --- a/WebCore/platform/graphics/android/BaseTile.cpp +++ b/WebCore/platform/graphics/android/BaseTile.cpp @@ -168,8 +168,12 @@ void BaseTile::draw(float transparency, SkRect& rect) } // Early return if set to un-usable in purpose! - if (!m_usable) { - XLOG("early return at BaseTile::draw b/c tile set to unusable !"); + m_atomicSync.lock(); + bool usable = m_usable; + bool isTexturePainted = m_lastPaintedPicture; + m_atomicSync.unlock(); + if (!usable || !isTexturePainted) { + XLOG("early return at BaseTile::draw b/c tile set to unusable or not painted !"); return; } @@ -180,13 +184,8 @@ void BaseTile::draw(float transparency, SkRect& rect) return; } - m_atomicSync.lock(); - bool isTexturePainted = m_lastPaintedPicture; - m_atomicSync.unlock(); - - if (isTexturePainted) - TilesManager::instance()->shader()->drawQuad(rect, textureInfo->m_textureId, - transparency); + TilesManager::instance()->shader()->drawQuad(rect, textureInfo->m_textureId, + transparency); m_texture->consumerRelease(); } |