| Index: cc/CCTextureUpdateController.cpp
|
| diff --git a/cc/CCTextureUpdateController.cpp b/cc/CCTextureUpdateController.cpp
|
| index 32923e75bbbb6329eb199926b971ba7b69b96a04..6965c851b030b92913a06e31fadb8f5203fbf4f8 100644
|
| --- a/cc/CCTextureUpdateController.cpp
|
| +++ b/cc/CCTextureUpdateController.cpp
|
| @@ -11,7 +11,6 @@
|
| #include "TextureUploader.h"
|
| #include "TraceEvent.h"
|
| #include <limits>
|
| -#include <wtf/CurrentTime.h>
|
|
|
| namespace {
|
|
|
| @@ -49,9 +48,7 @@ CCTextureUpdateController::CCTextureUpdateController(CCTextureUpdateControllerCl
|
| , m_queue(queue)
|
| , m_resourceProvider(resourceProvider)
|
| , m_uploader(uploader)
|
| - , m_monotonicTimeLimit(0)
|
| , m_textureUpdatesPerTick(maxFullUpdatesPerTick(uploader))
|
| - , m_firstUpdateAttempt(true)
|
| {
|
| }
|
|
|
| @@ -59,28 +56,12 @@ CCTextureUpdateController::~CCTextureUpdateController()
|
| {
|
| }
|
|
|
| -void CCTextureUpdateController::performMoreUpdates(
|
| - double monotonicTimeLimit)
|
| +void CCTextureUpdateController::start()
|
| {
|
| - ASSERT(monotonicTimeLimit >= m_monotonicTimeLimit);
|
| - m_monotonicTimeLimit = monotonicTimeLimit;
|
| -
|
| - // Update already in progress.
|
| - if (m_timer->isActive())
|
| - return;
|
| -
|
| - // Call updateMoreTexturesNow() directly unless it's the first update
|
| - // attempt. This ensures that we empty the update queue in a finite
|
| - // amount of time.
|
| - if (m_firstUpdateAttempt) {
|
| - // Post a 0-delay task when no updates were left. When it runs,
|
| - // readyToFinalizeTextureUpdates() will be called.
|
| - if (!updateMoreTexturesIfEnoughTimeRemaining())
|
| - m_timer->startOneShot(0);
|
| -
|
| - m_firstUpdateAttempt = false;
|
| - } else
|
| - updateMoreTexturesNow();
|
| + // Post a 0-delay task when no updates were left. When it runs,
|
| + // updateTexturesCompleted() will be called.
|
| + if (!updateMoreTextures())
|
| + m_timer->startOneShot(0);
|
| }
|
|
|
| void CCTextureUpdateController::discardUploadsToEvictedResources()
|
| @@ -127,15 +108,10 @@ void CCTextureUpdateController::finalize()
|
|
|
| void CCTextureUpdateController::onTimerFired()
|
| {
|
| - if (!updateMoreTexturesIfEnoughTimeRemaining())
|
| + if (!updateMoreTextures())
|
| m_client->readyToFinalizeTextureUpdates();
|
| }
|
|
|
| -double CCTextureUpdateController::monotonicTimeNow() const
|
| -{
|
| - return monotonicallyIncreasingTime();
|
| -}
|
| -
|
| double CCTextureUpdateController::updateMoreTexturesTime() const
|
| {
|
| return textureUpdateTickRate;
|
| @@ -146,7 +122,8 @@ size_t CCTextureUpdateController::updateMoreTexturesSize() const
|
| return m_textureUpdatesPerTick;
|
| }
|
|
|
| -bool CCTextureUpdateController::updateMoreTexturesIfEnoughTimeRemaining()
|
| +// Performs lazy texture updates. Currently only full uploads.
|
| +bool CCTextureUpdateController::updateMoreTextures()
|
| {
|
| // Uploader might be busy when we're too aggressive in our upload time
|
| // estimate. We use a different timeout here to prevent unnecessary
|
| @@ -159,22 +136,12 @@ bool CCTextureUpdateController::updateMoreTexturesIfEnoughTimeRemaining()
|
| if (!m_queue->fullUploadSize())
|
| return false;
|
|
|
| - bool hasTimeRemaining = monotonicTimeNow() < m_monotonicTimeLimit - updateMoreTexturesTime();
|
| - if (hasTimeRemaining)
|
| - updateMoreTexturesNow();
|
| -
|
| - return true;
|
| -}
|
| -
|
| -void CCTextureUpdateController::updateMoreTexturesNow()
|
| -{
|
| size_t uploads = std::min(
|
| m_queue->fullUploadSize(), updateMoreTexturesSize());
|
| m_timer->startOneShot(
|
| updateMoreTexturesTime() / updateMoreTexturesSize() * uploads);
|
|
|
| - if (!uploads)
|
| - return;
|
| + ASSERT(uploads);
|
|
|
| size_t uploadCount = 0;
|
| m_uploader->beginUploads();
|
| @@ -186,6 +153,7 @@ void CCTextureUpdateController::updateMoreTexturesNow()
|
| }
|
| m_uploader->endUploads();
|
| m_resourceProvider->shallowFlushIfSupported();
|
| + return true;
|
| }
|
|
|
| }
|
|
|