summaryrefslogtreecommitdiffstats
path: root/cc/texture_uploader.cc
diff options
context:
space:
mode:
authorreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-03 20:52:32 +0000
committerreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-03 20:52:32 +0000
commit2b37dfda8941c7bd4fbf73ed2aa8b8045ed50342 (patch)
tree080b117e2d1d2e4a24d8d5ec4a0089bbe71a59ef /cc/texture_uploader.cc
parent0f97c466741d34cd77df68b3795ed72000c1f0ad (diff)
downloadchromium_src-2b37dfda8941c7bd4fbf73ed2aa8b8045ed50342.zip
chromium_src-2b37dfda8941c7bd4fbf73ed2aa8b8045ed50342.tar.gz
chromium_src-2b37dfda8941c7bd4fbf73ed2aa8b8045ed50342.tar.bz2
cc: Move textureUploadFlushPeriod to TextureUploader.
This moves texture upload related flushing to the TextureUploader class. This is a more appropriate place to handle this type of flushing and makes it possible to avoid some unnecessary flushes. BUG= TEST=cc_unittests Review URL: https://chromiumcodereview.appspot.com/11367054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/texture_uploader.cc')
-rw-r--r--cc/texture_uploader.cc23
1 files changed, 22 insertions, 1 deletions
diff --git a/cc/texture_uploader.cc b/cc/texture_uploader.cc
index 6d4dc4f..5603d62 100644
--- a/cc/texture_uploader.cc
+++ b/cc/texture_uploader.cc
@@ -31,6 +31,9 @@ static const size_t uploadHistorySizeInitial = 100;
// More than one thread will not access this variable, so we do not need to synchronize access.
static const double defaultEstimatedTexturesPerSecond = 48.0 * 60.0;
+// Flush interval when performing texture uploads.
+const int textureUploadFlushPeriod = 4;
+
} // anonymous namespace
namespace cc {
@@ -89,11 +92,15 @@ bool TextureUploader::Query::isNonBlocking()
}
TextureUploader::TextureUploader(
- WebKit::WebGraphicsContext3D* context, bool useMapTexSubImage)
+ WebKit::WebGraphicsContext3D* context,
+ bool useMapTexSubImage,
+ bool useShallowFlush)
: m_context(context)
, m_numBlockingTextureUploads(0)
, m_useMapTexSubImage(useMapTexSubImage)
, m_subImageSize(0)
+ , m_useShallowFlush(useShallowFlush)
+ , m_numTextureUploadsSinceLastFlush(0)
{
for (size_t i = uploadHistorySizeInitial; i > 0; i--)
m_texturesPerSecondHistory.insert(defaultEstimatedTexturesPerSecond);
@@ -173,6 +180,20 @@ void TextureUploader::upload(const uint8* image,
if (isFullUpload)
endQuery();
+
+ m_numTextureUploadsSinceLastFlush++;
+ if (m_numTextureUploadsSinceLastFlush >= textureUploadFlushPeriod)
+ flush();
+}
+
+void TextureUploader::flush() {
+ if (!m_numTextureUploadsSinceLastFlush)
+ return;
+
+ if (m_useShallowFlush)
+ m_context->shallowFlushCHROMIUM();
+
+ m_numTextureUploadsSinceLastFlush = 0;
}
void TextureUploader::uploadWithTexSubImage(const uint8* image,