summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics')
-rw-r--r--WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp10
-rw-r--r--WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h13
2 files changed, 12 insertions, 11 deletions
diff --git a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp
index 1615e0d..334f7fd 100644
--- a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp
+++ b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp
@@ -40,7 +40,6 @@ BackedDoubleBufferedTexture::BackedDoubleBufferedTexture(uint32_t w, uint32_t h,
: DoubleBufferedTexture(eglGetCurrentContext())
, m_usedLevel(-1)
, m_owner(0)
- , m_painter(0)
, m_busy(false)
{
m_bitmap.setConfig(config, w, h);
@@ -95,7 +94,6 @@ void BackedDoubleBufferedTexture::producerUpdate(BaseTile* painter,
}
m_varLock.lock();
- m_painter = painter;
// set the painting information for this texture
if (equalsIdTextureA(textureInfo->m_textureId))
m_paintingInfoA = info;
@@ -125,13 +123,15 @@ bool BackedDoubleBufferedTexture::consumerTextureSimilar(PaintingInfo& info)
bool BackedDoubleBufferedTexture::acquire(BaseTile* owner)
{
- // if the writable texture is currently being written to we can't change the
- // owner out from underneath that texture
- android::Mutex::Autolock lock(m_varLock);
if (m_owner == owner)
return true;
+
+ // if the writable texture is busy (i.e. currently being written to) then we
+ // can't change the owner out from underneath that texture
+ m_varLock.lock();
if (m_busy)
return false;
+ m_varLock.unlock();
if (m_owner)
m_owner->removeTexture();
diff --git a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h
index 9bbda49..1faa110 100644
--- a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h
+++ b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h
@@ -97,15 +97,15 @@ public:
// We use this to prioritize the order in which we reclaim textures, see
// TilesManager::getAvailableTexture() for more information.
int usedLevel() { return m_usedLevel; }
- void setUsedLevel(int used) { android::Mutex::Autolock lock(m_varLock); m_usedLevel = used; }
+ void setUsedLevel(int used) { m_usedLevel = used; }
- // assigns ownership of the texture to the tile if possible
+ // allows consumer thread to assign ownership of the texture to the tile. It
+ // returns false if ownership cannot be transferred because the tile is busy
bool acquire(BaseTile* owner);
// private member accessor functions
- BaseTile* owner() { android::Mutex::Autolock lock(m_varLock); return m_owner; }
- BaseTile* painter() { return m_painter; }
- SkCanvas* canvas() { return m_canvas; }
+ BaseTile* owner() { return m_owner; } // only used by the consumer thread
+ SkCanvas* canvas() { return m_canvas; } // only used by the producer thread
// checks to see if the current readable texture equals the provided PaintingInfo
bool consumerTextureUpToDate(PaintingInfo& info);
@@ -119,7 +119,8 @@ private:
SkCanvas* m_canvas;
int m_usedLevel;
BaseTile* m_owner;
- BaseTile* m_painter;
+
+ //The following values are shared among threads and use m_varLock to stay synced
PaintingInfo m_paintingInfoA;
PaintingInfo m_paintingInfoB;
bool m_busy;