Skip to content
This repository has been archived by the owner on Jul 30, 2022. It is now read-only.

Commit

Permalink
Merge 4c0d3b5
Browse files Browse the repository at this point in the history
Change-Id: I11384be619b8147cc0a335ee134eb6e91a495398
  • Loading branch information
Jean-Baptiste Queru committed Mar 27, 2012
2 parents ff1fac5 + 4c0d3b5 commit 6724577
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 28 deletions.
Expand Up @@ -104,7 +104,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;
Expand All @@ -122,7 +122,6 @@ void TexturesGenerator::removeOperationsForFilter(OperationFilter* filter, bool

status_t TexturesGenerator::readyToRun()
{
TilesManager::instance()->markGeneratorAsReady();
XLOG("Thread ready to run");
return NO_ERROR;
}
Expand Down Expand Up @@ -192,7 +191,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();
Expand Down
7 changes: 5 additions & 2 deletions Source/WebCore/platform/graphics/android/TexturesGenerator.h
Expand Up @@ -39,12 +39,14 @@ using namespace android;

class BaseLayerAndroid;
class LayerAndroid;
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();

Expand All @@ -63,6 +65,7 @@ class TexturesGenerator : public Thread {
android::Condition mRequestedOperationsCond;
bool m_waitForCompletion;
QueuedOperation* m_currentOperation;
TilesManager* m_tilesManager;
};

} // namespace WebCore
Expand Down
6 changes: 1 addition & 5 deletions Source/WebCore/platform/graphics/android/TilesManager.cpp
Expand Up @@ -112,7 +112,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");
}

Expand Down Expand Up @@ -411,7 +411,6 @@ void TilesManager::setMaxLayerTextureCount(int max)
m_hasLayerTextures = true;
}


float TilesManager::tileWidth()
{
return TILE_WIDTH;
Expand Down Expand Up @@ -488,9 +487,6 @@ TilesManager* TilesManager::instance()
if (!gInstance) {
gInstance = new TilesManager();
XLOG("instance(), new gInstance is %x", gInstance);
XLOG("Waiting for the generator...");
gInstance->waitForGenerator();
XLOG("Generator ready!");
}
return gInstance;
}
Expand Down
19 changes: 1 addition & 18 deletions Source/WebCore/platform/graphics/android/TilesManager.h
Expand Up @@ -49,6 +49,7 @@ class PaintedSurface;

class TilesManager {
public:
// May only be called from the UI thread
static TilesManager* instance();
static GLint getMaxTextureSize();
static int getMaxTextureAllocation();
Expand Down Expand Up @@ -93,15 +94,6 @@ class TilesManager {

BaseTileTexture* getAvailableTexture(BaseTile* owner);

void markGeneratorAsReady()
{
{
android::Mutex::Autolock lock(m_generatorLock);
m_generatorReady = true;
}
m_generatorReadyCond.signal();
}

void printTextures();

void resetTextureUsage(TiledPage* page);
Expand Down Expand Up @@ -202,13 +194,6 @@ class TilesManager {
private:
TilesManager();

void waitForGenerator()
{
android::Mutex::Autolock lock(m_generatorLock);
while (!m_generatorReady)
m_generatorReadyCond.wait(m_generatorLock);
}

void deallocateTexturesVector(unsigned long long sparedDrawCount,
WTF::Vector<BaseTileTexture*>& textures);

Expand All @@ -235,8 +220,6 @@ class TilesManager {
sp<TexturesGenerator> m_pixmapsGenerationThread;

android::Mutex m_texturesLock;
android::Mutex m_generatorLock;
android::Condition m_generatorReadyCond;

static TilesManager* gInstance;

Expand Down

0 comments on commit 6724577

Please sign in to comment.