Chromium Code Reviews| Index: cc/resources/resource_pool.cc |
| diff --git a/cc/resources/resource_pool.cc b/cc/resources/resource_pool.cc |
| index ddf71cf15cc2e1ad85ec5a94a5f8b64688888ac6..eaf5ec3144ad8db118dbf5099e9230212ff069b5 100644 |
| --- a/cc/resources/resource_pool.cc |
| +++ b/cc/resources/resource_pool.cc |
| @@ -106,7 +106,7 @@ Resource* ResourcePool::AcquireResource(const gfx::Size& size, |
| continue; |
| // Transfer resource to |in_use_resources_|. |
| - in_use_resources_.set(resource->id(), it->Pass()); |
| + in_use_resources_[resource->id()] = it->Pass(); |
|
Matt Giuca
2015/11/19 23:42:26
nit: It seems that std::move is allowed now. I'm n
Matt Giuca
2015/11/19 23:42:26
nit: There is a trailing space at the end of this
limasdf
2015/11/20 15:20:04
Done.
|
| unused_resources_.erase(it); |
| in_use_memory_usage_bytes_ += ResourceUtil::UncheckedSizeInBytes<size_t>( |
| resource->size(), resource->format()); |
| @@ -130,7 +130,7 @@ Resource* ResourcePool::AcquireResource(const gfx::Size& size, |
| ++total_resource_count_; |
| Resource* resource = pool_resource.get(); |
| - in_use_resources_.set(resource->id(), std::move(pool_resource)); |
| + in_use_resources_[resource->id()] = std::move(pool_resource); |
| in_use_memory_usage_bytes_ += ResourceUtil::UncheckedSizeInBytes<size_t>( |
| resource->size(), resource->format()); |
| return resource; |
| @@ -151,7 +151,7 @@ Resource* ResourcePool::TryAcquireResourceWithContentId(uint64_t content_id) { |
| DCHECK(resource_provider_->CanLockForWrite(resource->id())); |
| // Transfer resource to |in_use_resources_|. |
| - in_use_resources_.set(resource->id(), it->Pass()); |
| + in_use_resources_[resource->id()] = it->Pass(); |
| unused_resources_.erase(it); |
| in_use_memory_usage_bytes_ += ResourceUtil::UncheckedSizeInBytes<size_t>( |
| resource->size(), resource->format()); |
| @@ -162,12 +162,15 @@ void ResourcePool::ReleaseResource(Resource* resource, uint64_t content_id) { |
| auto it = in_use_resources_.find(resource->id()); |
| DCHECK(it != in_use_resources_.end()); |
| - PoolResource* pool_resource = it->second; |
| + PoolResource* pool_resource = it->second.get(); |
| pool_resource->set_content_id(content_id); |
| pool_resource->set_last_usage(base::TimeTicks::Now()); |
| // Transfer resource to |busy_resources_|. |
| - busy_resources_.push_front(in_use_resources_.take_and_erase(it)); |
| + //busy_resources_.push_front(in_use_resources_.take_and_erase(it)); |
| + scoped_ptr<PoolResource> my_resource = it->second.Pass(); |
|
limasdf
2015/11/19 13:48:51
take_and_erase() returns scoped_ptr and erase iter
Matt Giuca
2015/11/19 23:42:26
This code can be simplified. The above code gets a
Matt Giuca
2015/11/19 23:42:26
What do you mean it doesn't work? (I patched your
limasdf
2015/11/20 15:20:04
Sorry. Because of trybot fail, I was thinking ther
limasdf
2015/11/20 15:20:05
On line#175, |pool_resource| is being used, so kee
Matt Giuca
2015/11/23 02:17:49
Acknowledged.
|
| + in_use_resources_.erase(it); |
| + busy_resources_.push_front(std::move(my_resource)); |
| in_use_memory_usage_bytes_ -= ResourceUtil::UncheckedSizeInBytes<size_t>( |
| pool_resource->size(), pool_resource->format()); |