diff options
Diffstat (limited to 'Source/WebCore/platform/graphics/android/rendering/TexturesGenerator.cpp')
-rw-r--r-- | Source/WebCore/platform/graphics/android/rendering/TexturesGenerator.cpp | 51 |
1 files changed, 17 insertions, 34 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/TexturesGenerator.cpp b/Source/WebCore/platform/graphics/android/rendering/TexturesGenerator.cpp index f884e52..dd645d9 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TexturesGenerator.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/TexturesGenerator.cpp @@ -39,16 +39,27 @@ namespace WebCore { +bool TexturesGenerator::tryUpdateOperationWithPainter(Tile* tile, TilePainter* painter) +{ + android::Mutex::Autolock lock(mRequestedOperationsLock); + if (!mRequestedOperationsHash.contains(tile)) + return false; + + static_cast<PaintTileOperation*>(mRequestedOperationsHash.get(tile))->updatePainter(painter); + return true; +} + void TexturesGenerator::scheduleOperation(QueuedOperation* operation) { { android::Mutex::Autolock lock(mRequestedOperationsLock); mRequestedOperations.append(operation); + mRequestedOperationsHash.set(operation->uniquePtr(), operation); } mRequestedOperationsCond.signal(); } -void TexturesGenerator::removeOperationsForFilter(OperationFilter* filter, bool waitForRunning) +void TexturesGenerator::removeOperationsForFilter(OperationFilter* filter) { if (!filter) return; @@ -58,39 +69,13 @@ void TexturesGenerator::removeOperationsForFilter(OperationFilter* filter, bool QueuedOperation* operation = mRequestedOperations[i]; if (filter->check(operation)) { mRequestedOperations.remove(i); + mRequestedOperationsHash.remove(operation->uniquePtr()); delete operation; } else { i++; } } - - if (waitForRunning && m_currentOperation) { - QueuedOperation* operation = m_currentOperation; - - if (operation && filter->check(operation)) { - m_waitForCompletion = true; - // The reason we are signaling the transferQueue is : - // TransferQueue may be waiting a slot to work on, but now UI - // thread is waiting for Tex Gen thread to finish first before the - // UI thread can free a slot for the transferQueue. - // Therefore, it could be a deadlock. - // 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. - m_tilesManager->transferQueue()->interruptTransferQueue(true); - } - - delete filter; - - // At this point, it means that we are currently executing an operation that - // we want to be removed -- we should wait until it is done, so that - // when we return our caller can be sure that there is no more operations - // in the queue matching the given filter. - while (m_waitForCompletion) - mRequestedOperationsCond.wait(mRequestedOperationsLock); - } else { - delete filter; - } + delete filter; } status_t TexturesGenerator::readyToRun() @@ -108,6 +93,7 @@ QueuedOperation* TexturesGenerator::popNext() int currentPriority = current->priority(); if (currentPriority < 0) { mRequestedOperations.removeLast(); + mRequestedOperationsHash.remove(current->uniquePtr()); return current; } int currentIndex = mRequestedOperations.size() - 1; @@ -118,6 +104,7 @@ QueuedOperation* TexturesGenerator::popNext() if (nextPriority < 0) { // Found a very high priority item, go ahead and just handle it now mRequestedOperations.remove(i); + mRequestedOperationsHash.remove(next->uniquePtr()); return next; } // pick items preferrably by priority, or if equal, by order of @@ -129,6 +116,7 @@ QueuedOperation* TexturesGenerator::popNext() } } mRequestedOperations.remove(currentIndex); + mRequestedOperationsHash.remove(current->uniquePtr()); return current; } @@ -163,11 +151,6 @@ bool TexturesGenerator::threadLoop() m_currentOperation = 0; if (!mRequestedOperations.size()) stop = true; - if (m_waitForCompletion) { - m_waitForCompletion = false; - m_tilesManager->transferQueue()->interruptTransferQueue(false); - mRequestedOperationsCond.signal(); - } mRequestedOperationsLock.unlock(); if (oldOperation) delete oldOperation; // delete outside lock |