| Index: cc/resources/resource_provider.cc
|
| diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
|
| index 087f0fe7751364bed6f3b37281b1a4962d53cde9..ea8f8ee81f5374a789997fbe7d24b4534f568350 100644
|
| --- a/cc/resources/resource_provider.cc
|
| +++ b/cc/resources/resource_provider.cc
|
| @@ -587,7 +587,8 @@ void ResourceProvider::DeleteResource(ResourceId id) {
|
| DCHECK_EQ(resource->imported_count, 0);
|
| DCHECK(resource->pending_set_pixels || !resource->locked_for_write);
|
|
|
| - if (resource->exported_count > 0 || resource->lock_for_read_count > 0) {
|
| + if (resource->exported_count > 0 || resource->lock_for_read_count > 0 ||
|
| + !ReadLockFenceHasPassed(resource)) {
|
| resource->marked_for_deletion = true;
|
| return;
|
| } else {
|
| @@ -947,6 +948,12 @@ void ResourceProvider::UnlockForWrite(ResourceProvider::Resource* resource) {
|
| resource->locked_for_write = false;
|
| }
|
|
|
| +void ResourceProvider::EnableReadLockFences(ResourceId id) {
|
| + Resource* resource = GetResource(id);
|
| + DCHECK(resource);
|
| + resource->read_lock_fences_enabled = true;
|
| +}
|
| +
|
| ResourceProvider::ScopedReadLockGL::ScopedReadLockGL(
|
| ResourceProvider* resource_provider,
|
| ResourceId resource_id)
|
| @@ -1375,6 +1382,7 @@ void ResourceProvider::ReceiveFromChild(
|
| resource->mailbox = TextureMailbox(it->mailbox_holder.mailbox,
|
| it->mailbox_holder.texture_target,
|
| it->mailbox_holder.sync_point);
|
| + resource->read_lock_fences_enabled = it->read_lock_fences_enabled;
|
| }
|
| resource->child_id = child;
|
| // Don't allocate a texture for a child.
|
| @@ -1430,14 +1438,6 @@ void ResourceProvider::ReceiveReturnsFromParent(
|
| if (resource->exported_count)
|
| continue;
|
|
|
| - // Need to wait for the current read lock fence to pass before we can
|
| - // recycle this resource.
|
| - if (resource->read_lock_fences_enabled) {
|
| - if (current_read_lock_fence_.get())
|
| - current_read_lock_fence_->Set();
|
| - resource->read_lock_fence = current_read_lock_fence_;
|
| - }
|
| -
|
| if (returned.sync_point) {
|
| DCHECK(!resource->has_shared_bitmap_id);
|
| if (resource->origin == Resource::INTERNAL) {
|
| @@ -1482,6 +1482,7 @@ void ResourceProvider::TransferResource(GLES2Interface* gl,
|
| resource->mailbox_holder.texture_target = source->target;
|
| resource->filter = source->filter;
|
| resource->size = source->size;
|
| + resource->read_lock_fences_enabled = source->read_lock_fences_enabled;
|
| resource->is_repeated = (source->wrap_mode == GL_REPEAT);
|
|
|
| if (source->type == RESOURCE_TYPE_BITMAP) {
|
| @@ -1551,7 +1552,8 @@ void ResourceProvider::DeleteAndReturnUnusedResourcesToChild(
|
| bool is_lost =
|
| resource.lost ||
|
| (resource.type == RESOURCE_TYPE_GL_TEXTURE && lost_output_surface_);
|
| - if (resource.exported_count > 0 || resource.lock_for_read_count > 0) {
|
| + if (resource.exported_count > 0 || resource.lock_for_read_count > 0 ||
|
| + !ReadLockFenceHasPassed(&resource)) {
|
| if (style != FOR_SHUTDOWN) {
|
| // Defer this until we receive the resource back from the parent or
|
| // the read lock is released.
|
|
|