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

Unified Diff: cc/CCTextureUpdateController.cpp

Issue 10909020: Enable webkit_compositor_unittests (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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 9c448be081f8be4a611d833388daf192ec2eb466..25d41cca581bb25b83adb03ad0fbf5172fee4c23 100644
--- a/cc/CCTextureUpdateController.cpp
+++ b/cc/CCTextureUpdateController.cpp
@@ -92,9 +92,8 @@ void CCTextureUpdateController::updateTextures(CCResourceProvider* resourceProvi
copier->flush();
}
-CCTextureUpdateController::CCTextureUpdateController(CCTextureUpdateControllerClient* client, CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploader)
- : m_client(client)
- , m_timer(adoptPtr(new CCTimer(thread, this)))
+CCTextureUpdateController::CCTextureUpdateController(CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploader)
+ : m_timer(adoptPtr(new CCTimer(thread, this)))
, m_queue(queue)
, m_resourceProvider(resourceProvider)
, m_copier(copier)
@@ -108,40 +107,34 @@ CCTextureUpdateController::~CCTextureUpdateController()
{
}
+bool CCTextureUpdateController::hasMoreUpdates() const
+{
+ return m_queue->hasMoreUpdates();
+}
+
void CCTextureUpdateController::updateMoreTextures(double monotonicTimeLimit)
{
- ASSERT(monotonicTimeLimit >= m_monotonicTimeLimit);
m_monotonicTimeLimit = monotonicTimeLimit;
- // Update already in progress.
- if (m_timer->isActive())
+ if (!m_queue->hasMoreUpdates())
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,
- // updateTexturesCompleted() will be called.
- if (!updateMoreTexturesIfEnoughTimeRemaining())
- m_timer->startOneShot(0);
-
+ updateMoreTexturesIfEnoughTimeRemaining();
m_firstUpdateAttempt = false;
} else
updateMoreTexturesNow();
}
-void CCTextureUpdateController::discardUploads()
-{
- // CCTextureUpdateControllerClient::updateTexturesCompleted will be
- // called when all remaining texture copies are done.
- m_queue->clearUploads();
-}
-
void CCTextureUpdateController::onTimerFired()
{
- if (!updateMoreTexturesIfEnoughTimeRemaining())
- m_client->updateTexturesCompleted();
+ if (!m_queue->hasMoreUpdates())
+ return;
+
+ updateMoreTexturesIfEnoughTimeRemaining();
}
double CCTextureUpdateController::monotonicTimeNow() const
@@ -159,16 +152,11 @@ size_t CCTextureUpdateController::updateMoreTexturesSize() const
return textureUpdatesPerTick;
}
-bool CCTextureUpdateController::updateMoreTexturesIfEnoughTimeRemaining()
+void CCTextureUpdateController::updateMoreTexturesIfEnoughTimeRemaining()
{
- if (!m_queue->hasMoreUpdates())
- return false;
-
bool hasTimeRemaining = monotonicTimeNow() < m_monotonicTimeLimit - updateMoreTexturesTime();
if (hasTimeRemaining)
updateMoreTexturesNow();
-
- return true;
}
void CCTextureUpdateController::updateMoreTexturesNow()
« 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