summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/rendering/TexturesGenerator.cpp
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-05-11 16:03:54 -0700
committerChris Craik <ccraik@google.com>2012-05-14 11:15:04 -0700
commit425ef23631e3468c61a5740dd4e4bae3052cec48 (patch)
tree756f4ce43978ca025638653a06024d1d8661ffce /Source/WebCore/platform/graphics/android/rendering/TexturesGenerator.cpp
parentd236e597b13a93d21eafa2edeacb5092076937e1 (diff)
downloadexternal_webkit-425ef23631e3468c61a5740dd4e4bae3052cec48.zip
external_webkit-425ef23631e3468c61a5740dd4e4bae3052cec48.tar.gz
external_webkit-425ef23631e3468c61a5740dd4e4bae3052cec48.tar.bz2
Fix stale tile problem
bug:6483791 Update tile painter of outstanding operations Always schedule a paint operation if we can't update an outstanding one Remove old interruption code, as it's no longer used Change-Id: Ibcdb142d3d9b4ee7a52c78b5c121056089913211
Diffstat (limited to 'Source/WebCore/platform/graphics/android/rendering/TexturesGenerator.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TexturesGenerator.cpp51
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