diff options
Diffstat (limited to 'Source')
6 files changed, 15 insertions, 30 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLUtils.cpp b/Source/WebCore/platform/graphics/android/GLUtils.cpp index 68ce717..1578182 100644 --- a/Source/WebCore/platform/graphics/android/GLUtils.cpp +++ b/Source/WebCore/platform/graphics/android/GLUtils.cpp @@ -35,6 +35,7 @@ #include "TilesManager.h" #include <AndroidLog.h> +#include <android/native_window.h> #include <gui/SurfaceTexture.h> #include <wtf/CurrentTime.h> diff --git a/Source/WebCore/platform/graphics/android/LayerGroup.cpp b/Source/WebCore/platform/graphics/android/LayerGroup.cpp index d0138cc..5d8b726 100644 --- a/Source/WebCore/platform/graphics/android/LayerGroup.cpp +++ b/Source/WebCore/platform/graphics/android/LayerGroup.cpp @@ -297,7 +297,7 @@ bool LayerGroup::paint(BaseTile* tile, SkCanvas* canvas) float LayerGroup::opacity() { if (singleLayer()) - return getFirstLayer()->getOpacity(); + return getFirstLayer()->drawOpacity(); return 1.0; } diff --git a/Source/WebCore/platform/graphics/android/TexturesGenerator.cpp b/Source/WebCore/platform/graphics/android/TexturesGenerator.cpp index 83e04dc..3279ec2 100644 --- a/Source/WebCore/platform/graphics/android/TexturesGenerator.cpp +++ b/Source/WebCore/platform/graphics/android/TexturesGenerator.cpp @@ -76,7 +76,7 @@ void TexturesGenerator::removeOperationsForFilter(OperationFilter* filter, bool // The solution is use this as a flag to tell Tex Gen thread that // UI thread is waiting now, Tex Gen thread should not wait for the // queue any more. - TilesManager::instance()->transferQueue()->interruptTransferQueue(true); + m_tilesManager->transferQueue()->interruptTransferQueue(true); } delete filter; @@ -94,7 +94,6 @@ void TexturesGenerator::removeOperationsForFilter(OperationFilter* filter, bool status_t TexturesGenerator::readyToRun() { - TilesManager::instance()->markGeneratorAsReady(); ALOGV("Thread ready to run"); return NO_ERROR; } @@ -165,7 +164,7 @@ bool TexturesGenerator::threadLoop() stop = true; if (m_waitForCompletion) { m_waitForCompletion = false; - TilesManager::instance()->transferQueue()->interruptTransferQueue(false); + m_tilesManager->transferQueue()->interruptTransferQueue(false); mRequestedOperationsCond.signal(); } mRequestedOperationsLock.unlock(); diff --git a/Source/WebCore/platform/graphics/android/TexturesGenerator.h b/Source/WebCore/platform/graphics/android/TexturesGenerator.h index b79baa7..35a3386 100644 --- a/Source/WebCore/platform/graphics/android/TexturesGenerator.h +++ b/Source/WebCore/platform/graphics/android/TexturesGenerator.h @@ -38,11 +38,14 @@ namespace WebCore { using namespace android; +class TilesManager; + class TexturesGenerator : public Thread { public: - TexturesGenerator() : Thread(false) + TexturesGenerator(TilesManager* instance) : Thread(false) , m_waitForCompletion(false) - , m_currentOperation(0) { } + , m_currentOperation(0) + , m_tilesManager(instance) { } virtual ~TexturesGenerator() { } virtual status_t readyToRun(); @@ -58,6 +61,7 @@ private: android::Condition mRequestedOperationsCond; bool m_waitForCompletion; QueuedOperation* m_currentOperation; + TilesManager* m_tilesManager; }; } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp index e6577c6..1e9aee4 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.cpp +++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp @@ -100,7 +100,7 @@ TilesManager::TilesManager() m_availableTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION); m_tilesTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION); m_availableTilesTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION); - m_pixmapsGenerationThread = new TexturesGenerator(); + m_pixmapsGenerationThread = new TexturesGenerator(this); m_pixmapsGenerationThread->run("TexturesGenerator"); } @@ -414,8 +414,9 @@ void TilesManager::setMaxLayerTextureCount(int max) TransferQueue* TilesManager::transferQueue() { - // To minimize the memory usage, transfer queue can be set to minimal size - // if required. + // m_queue will be created on the UI thread, although it may + // be accessed from the TexturesGenerator. However, that can only happen after + // a previous transferQueue() call due to a prepare. if (!m_queue) m_queue = new TransferQueue(m_useMinimalMemory); return m_queue; @@ -446,9 +447,6 @@ TilesManager* TilesManager::instance() if (!gInstance) { gInstance = new TilesManager(); ALOGV("instance(), new gInstance is %x", gInstance); - ALOGV("Waiting for the generator..."); - gInstance->waitForGenerator(); - ALOGV("Generator ready!"); } return gInstance; } diff --git a/Source/WebCore/platform/graphics/android/TilesManager.h b/Source/WebCore/platform/graphics/android/TilesManager.h index 0640825..eed99c2 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.h +++ b/Source/WebCore/platform/graphics/android/TilesManager.h @@ -45,6 +45,7 @@ namespace WebCore { class TilesManager { public: + // May only be called from the UI thread static TilesManager* instance(); static GLint getMaxTextureSize(); static int getMaxTextureAllocation(); @@ -75,15 +76,6 @@ public: BaseTileTexture* getAvailableTexture(BaseTile* owner); - void markGeneratorAsReady() - { - { - android::Mutex::Autolock lock(m_generatorLock); - m_generatorReady = true; - } - m_generatorReadyCond.signal(); - } - void printTextures(); // m_highEndGfx is written/read only on UI thread, no need for a lock. @@ -170,13 +162,6 @@ public: private: TilesManager(); - void waitForGenerator() - { - android::Mutex::Autolock lock(m_generatorLock); - while (!m_generatorReady) - m_generatorReadyCond.wait(m_generatorLock); - } - void discardTexturesVector(unsigned long long sparedDrawCount, WTF::Vector<BaseTileTexture*>& textures, bool deallocateGLTextures); @@ -206,8 +191,6 @@ private: sp<TexturesGenerator> m_pixmapsGenerationThread; android::Mutex m_texturesLock; - android::Mutex m_generatorLock; - android::Condition m_generatorReadyCond; static TilesManager* gInstance; |