summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/android/BaseTileTexture.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTileTexture.cpp124
1 files changed, 9 insertions, 115 deletions
diff --git a/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp b/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp
index caaf116..6da1b77 100644
--- a/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp
@@ -53,10 +53,7 @@
namespace WebCore {
BaseTileTexture::BaseTileTexture(uint32_t w, uint32_t h)
- : DoubleBufferedTexture(eglGetCurrentContext(),
- TilesManager::instance()->getSharedTextureMode())
- , m_owner(0)
- , m_busy(false)
+ : m_owner(0)
{
m_size.set(w, h);
m_ownTextureId = 0;
@@ -71,10 +68,6 @@ BaseTileTexture::BaseTileTexture(uint32_t w, uint32_t h)
BaseTileTexture::~BaseTileTexture()
{
- if (m_sharedTextureMode == EglImageMode) {
- SharedTexture* textures[3] = { m_textureA, m_textureB, 0 };
- destroyTextures(textures);
- }
#ifdef DEBUG_COUNT
ClassTracker::instance()->decrement("BaseTileTexture");
#endif
@@ -98,71 +91,6 @@ void BaseTileTexture::discardGLTexture()
}
}
-void BaseTileTexture::destroyTextures(SharedTexture** textures)
-{
- int x = 0;
- while (textures[x]) {
- // We need to delete the source texture and EGLImage in the texture
- // generation thread. In theory we should be able to delete the EGLImage
- // from either thread, but it currently throws an error if not deleted
- // in the same EGLContext from which it was created.
- textures[x]->lock();
- DeleteTextureOperation* operation = new DeleteTextureOperation(
- textures[x]->getSourceTextureId(), textures[x]->getEGLImage());
- textures[x]->unlock();
- TilesManager::instance()->scheduleOperation(operation);
- x++;
- }
-}
-
-TextureInfo* BaseTileTexture::producerLock()
-{
- m_busyLock.lock();
- m_busy = true;
- m_busyLock.unlock();
- return DoubleBufferedTexture::producerLock();
-}
-
-void BaseTileTexture::producerRelease()
-{
- DoubleBufferedTexture::producerRelease();
- setNotBusy();
-}
-
-void BaseTileTexture::producerReleaseAndSwap()
-{
- DoubleBufferedTexture::producerReleaseAndSwap();
- setNotBusy();
-}
-
-void BaseTileTexture::setNotBusy()
-{
- android::Mutex::Autolock lock(m_busyLock);
- m_busy = false;
- m_busyCond.signal();
-}
-
-bool BaseTileTexture::busy()
-{
- android::Mutex::Autolock lock(m_busyLock);
- return m_busy;
-}
-
-void BaseTileTexture::producerUpdate(TextureInfo* textureInfo, const SkBitmap& bitmap)
-{
- // no need to upload a texture since the bitmap is empty
- if (!bitmap.width() && !bitmap.height()) {
- producerRelease();
- return;
- }
-
- // After the tiled layer checked in, this is not called anyway.
- // TODO: cleanup the old code path for layer painting
- // GLUtils::paintTextureWithBitmap(info, m_size, bitmap, 0, 0);
-
- producerReleaseAndSwap();
-}
-
bool BaseTileTexture::acquire(TextureOwner* owner, bool force)
{
if (m_owner == owner)
@@ -173,39 +101,21 @@ bool BaseTileTexture::acquire(TextureOwner* owner, bool force)
bool BaseTileTexture::setOwner(TextureOwner* owner, bool force)
{
- // 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_busyLock.lock();
- while (m_busy && force)
- m_busyCond.wait(m_busyLock);
- bool busy = m_busy;
- m_busyLock.unlock();
-
- if (!busy) {
- // if we are not busy we can try to remove the texture from the layer;
- // LayerAndroid::removeTexture() is protected by the same lock as
- // LayerAndroid::paintBitmapGL(), so either we execute removeTexture()
- // first and paintBitmapGL() will bail out, or we execute it after,
- // and paintBitmapGL() will mark the texture as busy before
- // relinquishing the lock. LayerAndroid::removeTexture() will call
- // BaseTileTexture::release(), which will then do nothing
- // if the texture is busy and we then don't return true.
- bool proceed = true;
- if (m_owner && m_owner != owner)
- proceed = m_owner->removeTexture(this);
+ bool proceed = true;
+ if (m_owner && m_owner != owner)
+ proceed = m_owner->removeTexture(this);
- if (proceed) {
- m_owner = owner;
- return true;
- }
+ if (proceed) {
+ m_owner = owner;
+ return true;
}
+
return false;
}
bool BaseTileTexture::release(TextureOwner* owner)
{
- android::Mutex::Autolock lock(m_busyLock);
- XLOG("texture %p releasing tile %p, m_owner %p, m_busy %d", this, owner, m_owner, m_busy);
+ XLOG("texture %p releasing tile %p, m_owner %p", this, owner, m_owner);
if (m_owner != owner)
return false;
@@ -213,22 +123,6 @@ bool BaseTileTexture::release(TextureOwner* owner)
return true;
}
-void BaseTileTexture::setTile(TextureInfo* info, int x, int y,
- float scale, TilePainter* painter,
- unsigned int pictureCount)
-{
- TextureTileInfo* textureInfo = m_texturesInfo.get(getWriteableTexture());
- if (!textureInfo) {
- textureInfo = new TextureTileInfo();
- }
- textureInfo->m_x = x;
- textureInfo->m_y = y;
- textureInfo->m_scale = scale;
- textureInfo->m_painter = painter;
- textureInfo->m_picture = pictureCount;
- m_texturesInfo.set(getWriteableTexture(), textureInfo);
-}
-
float BaseTileTexture::scale()
{
TextureTileInfo* textureInfo = &m_ownTextureTileInfo;