From: Nicolas Roard Date: Mon, 13 Dec 2010 18:06:43 +0000 (-0800) Subject: Fix onDestroy() X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e846e5780f8a50e85389d25846b866ba79e85e14;p=android-x86%2Fexternal-webkit.git Fix onDestroy() Change-Id: Ie58ff8d0da2159639b2c05ea14a5bea811824d3e --- diff --git a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp index ced0c2ea8..37e8e7bb7 100644 --- a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp +++ b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp @@ -53,9 +53,11 @@ BackedDoubleBufferedTexture::~BackedDoubleBufferedTexture() { m_bitmap.reset(); delete m_canvas; + SharedTexture* textures[3] = { &m_textureA, &m_textureB, 0 }; + destroyTextures(textures); } -void BackedDoubleBufferedTexture::onDestroy(SharedTexture** textures) +void BackedDoubleBufferedTexture::destroyTextures(SharedTexture** textures) { int x = 0; while (textures[x] != 0) { @@ -136,4 +138,9 @@ void BackedDoubleBufferedTexture::release(BaseTile* owner) m_owner = 0; } +void BackedDoubleBufferedTexture::release() +{ + m_owner = 0; +} + } // namespace WebCore diff --git a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h index 76b9f3641..69578d508 100644 --- a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h +++ b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h @@ -67,6 +67,7 @@ public: // returns false if ownership cannot be transferred because the tile is busy bool acquire(BaseTile* owner); void release(BaseTile* owner); + void release(); // private member accessor functions BaseTile* owner() { return m_owner; } // only used by the consumer thread @@ -75,10 +76,9 @@ public: // This is to be only used for debugging on the producer thread bool busy() { return m_busy; } -protected: - virtual void onDestroy(SharedTexture** textures); - private: + void destroyTextures(SharedTexture** textures); + SkBitmap m_bitmap; SkCanvas* m_canvas; int m_usedLevel; diff --git a/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp b/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp index a3ae5abd2..31a118678 100644 --- a/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp +++ b/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp @@ -58,8 +58,6 @@ DoubleBufferedTexture::DoubleBufferedTexture(EGLContext sharedContext) DoubleBufferedTexture::~DoubleBufferedTexture() { - SharedTexture* textures[3] = { &m_textureA, &m_textureB, 0 }; - onDestroy(textures); #ifdef DEBUG_COUNT gDoubleBufferedTextureCount--; #endif diff --git a/WebCore/platform/graphics/android/DoubleBufferedTexture.h b/WebCore/platform/graphics/android/DoubleBufferedTexture.h index c028302a5..c7f5f498c 100644 --- a/WebCore/platform/graphics/android/DoubleBufferedTexture.h +++ b/WebCore/platform/graphics/android/DoubleBufferedTexture.h @@ -51,17 +51,13 @@ public: void consumerRelease(); protected: - // enables sub-classes to signal the provider thread that the consumer is - // being deleted and therefore should clean up any producer specific - // textures or EGLImages - virtual void onDestroy(SharedTexture** textures) { }; + SharedTexture m_textureA; + SharedTexture m_textureB; private: SharedTexture* getReadableTexture(); SharedTexture* getWriteableTexture(); - SharedTexture m_textureA; - SharedTexture m_textureB; SharedTexture* m_writeableTexture; SharedTexture* m_lockedConsumerTexture; // only used by the consumer