Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4387)

Unified Diff: cc/CCTextureUpdateController.cpp

Issue 10933095: cc: Remove resource updates from scheduler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another rebase Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/CCTextureUpdateController.h ('k') | cc/CCTextureUpdateControllerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
« no previous file with comments | « cc/CCTextureUpdateController.h ('k') | cc/CCTextureUpdateControllerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698