cc: Move max pending uploads decision to update controller.
Replace TextureUploader::isBusy() function with
TextureUploader::pendingUploads() so that the update controller can
instead make the decision about how many pending uploads to allow.
Use number of uploads rather than number of queries to determine when
more uploads are allowed. This provides more fare scheduling of small
upload batches.
BUG=145825
TEST=cc_unitests
Review URL: https://chromiumcodereview.appspot.com/10989040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159418 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/CCTextureUpdateController.cpp b/cc/CCTextureUpdateController.cpp
index a844ee4..bbc3e7a 100644
--- a/cc/CCTextureUpdateController.cpp
+++ b/cc/CCTextureUpdateController.cpp
@@ -27,6 +27,9 @@
// Flush interval when performing texture uploads.
static const int textureUploadFlushPeriod = 4;
+// Number of pending update intervals to allow.
+static const size_t maxPendingUpdateIntervals = 2;
+
} // anonymous namespace
namespace cc {
@@ -144,12 +147,17 @@
return m_textureUpdatesPerTick;
}
+size_t CCTextureUpdateController::maxPendingUpdates() const
+{
+ return updateMoreTexturesSize() * maxPendingUpdateIntervals;
+}
+
bool CCTextureUpdateController::updateMoreTexturesIfEnoughTimeRemaining()
{
- // Uploader might be busy when we're too aggressive in our upload time
- // estimate. We use a different timeout here to prevent unnecessary
- // amounts of idle time.
- if (m_uploader->isBusy()) {
+ // Pending uploads will increase when we're too aggressive in our upload
+ // time estimate. We use a different timeout here to prevent unnecessary
+ // amounts of idle time when pending uploads have reached the max.
+ if (m_uploader->numPendingUploads() >= maxPendingUpdates()) {
m_timer->startOneShot(uploaderBusyTickRate);
return true;
}