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

Unified Diff: cc/resource_provider.cc

Issue 12321053: cc: Complete pending tile uploads if they are needed for tree activation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only flush when not in smoothness/animations Created 7 years, 9 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
Index: cc/resource_provider.cc
diff --git a/cc/resource_provider.cc b/cc/resource_provider.cc
index d5567274aea1478747aed7f528c152a6d1f7e768..65c30416cc78f2554f431784e696082129f8c5b1 100644
--- a/cc/resource_provider.cc
+++ b/cc/resource_provider.cc
@@ -74,6 +74,7 @@ ResourceProvider::Resource::Resource()
exported(false),
marked_for_deletion(false),
pending_set_pixels(false),
+ wait_for_set_pixels_inserted(false),
allocated(false),
enable_read_lock_fences(false),
read_lock_fence(NULL),
@@ -97,6 +98,7 @@ ResourceProvider::Resource::Resource(
exported(false),
marked_for_deletion(false),
pending_set_pixels(false),
+ wait_for_set_pixels_inserted(false),
allocated(false),
enable_read_lock_fences(false),
read_lock_fence(NULL),
@@ -118,6 +120,7 @@ ResourceProvider::Resource::Resource(
exported(false),
marked_for_deletion(false),
pending_set_pixels(false),
+ wait_for_set_pixels_inserted(false),
allocated(false),
enable_read_lock_fences(false),
read_lock_fence(NULL),
@@ -1087,13 +1090,33 @@ void ResourceProvider::BeginSetPixels(ResourceId id) {
resource->pending_set_pixels = true;
}
-bool ResourceProvider::DidSetPixelsComplete(ResourceId id) {
+void ResourceProvider::InsertWaitForSetPixels(ResourceId id) {
DCHECK(thread_checker_.CalledOnValidThread());
ResourceMap::iterator it = resources_.find(id);
CHECK(it != resources_.end());
Resource* resource = &it->second;
DCHECK(resource->locked_for_write);
DCHECK(resource->pending_set_pixels);
+ DCHECK(!resource->wait_for_set_pixels_inserted);
+
+ if (resource->gl_id) {
+ WebGraphicsContext3D* context3d = output_surface_->context3d();
+ GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, resource->gl_id));
+ GLC(context3d, context3d->waitAsyncTexImage2DCHROMIUM(GL_TEXTURE_2D));
+ GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, 0));
+ }
+
+ UnlockForWrite(id);
+ resource->wait_for_set_pixels_inserted = true;
+}
+
+bool ResourceProvider::DidSetPixelsComplete(ResourceId id) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ ResourceMap::iterator it = resources_.find(id);
+ CHECK(it != resources_.end());
+ Resource* resource = &it->second;
+ DCHECK(resource->locked_for_write || resource->wait_for_set_pixels_inserted);
+ DCHECK(resource->pending_set_pixels);
if (resource->gl_id) {
WebGraphicsContext3D* context3d = output_surface_->context3d();
@@ -1109,7 +1132,9 @@ bool ResourceProvider::DidSetPixelsComplete(ResourceId id) {
}
resource->pending_set_pixels = false;
- UnlockForWrite(id);
+ if (!resource->wait_for_set_pixels_inserted)
+ UnlockForWrite(id);
epenner 2013/03/11 19:18:40 Can you explain why we do this only when there is
Sami 2013/03/12 14:13:07 I guess the confusion comes from the fact that for
+ resource->wait_for_set_pixels_inserted = false;
return true;
}

Powered by Google App Engine
This is Rietveld 408576698