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

Unified Diff: cc/texture_uploader.cc

Issue 11367054: cc: Move textureUploadFlushPeriod to TextureUploader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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/texture_uploader.h ('k') | cc/texture_uploader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/texture_uploader.cc
diff --git a/cc/texture_uploader.cc b/cc/texture_uploader.cc
index 6d4dc4fbefe64b1798de437adf9e25f438ac1195..5603d62e16e6eb9a322b7d6eab56e51aedfaf359 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,
« no previous file with comments | « cc/texture_uploader.h ('k') | cc/texture_uploader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698