Chromium Code Reviews| Index: cc/resource_pool.cc |
| diff --git a/cc/resource_pool.cc b/cc/resource_pool.cc |
| index 91d1503677f8a46959fa1a120774e3221ce2a3d0..aa6558fc2c829711d02f5483c5b45982ff1f9ec8 100644 |
| --- a/cc/resource_pool.cc |
| +++ b/cc/resource_pool.cc |
| @@ -43,6 +43,12 @@ scoped_ptr<ResourcePool::Resource> ResourcePool::AcquireResource( |
| it != resources_.end(); ++it) { |
| Resource* resource = *it; |
| + // TODO(epenner): It would nice to DCHECK that this |
| + // doesn't happen two frames in a row for any resource |
| + // in this pool. |
| + if (!resource_provider_->canLockForWrite(resource->id())) |
| + continue; |
| + |
| if (resource->size() != size) |
| continue; |
| if (resource->format() != format) |
| @@ -55,6 +61,12 @@ scoped_ptr<ResourcePool::Resource> ResourcePool::AcquireResource( |
| // Create new resource. |
| Resource* resource = new Resource( |
| resource_provider_, size, format); |
| + |
| + // Extend all read locks on all resources until the resource is |
|
nduca
2013/02/05 22:39:05
Can we restrict this to only resources that are as
|
| + // finished being used, such that we know when resources are |
| + // truly safe to recycle. |
| + resource_provider_->enableReadLockFences(resource->id(), true); |
| + |
| memory_usage_bytes_ += resource->bytes(); |
| return make_scoped_ptr(resource); |
| } |