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

Side by Side Diff: cc/resources/resource_pool.cc

Issue 1455023002: cc: Replace Pass() with std::move() in some subdirs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pass-cc
Patch Set: pass-cc2: . Created 5 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 unified diff | Download patch
« no previous file with comments | « cc/quads/render_pass_unittest.cc ('k') | cc/resources/resource_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/resources/resource_pool.h" 5 #include "cc/resources/resource_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 format); 123 format);
124 } 124 }
125 125
126 DCHECK(ResourceUtil::VerifySizeInBytes<size_t>(pool_resource->size(), 126 DCHECK(ResourceUtil::VerifySizeInBytes<size_t>(pool_resource->size(),
127 pool_resource->format())); 127 pool_resource->format()));
128 total_memory_usage_bytes_ += ResourceUtil::UncheckedSizeInBytes<size_t>( 128 total_memory_usage_bytes_ += ResourceUtil::UncheckedSizeInBytes<size_t>(
129 pool_resource->size(), pool_resource->format()); 129 pool_resource->size(), pool_resource->format());
130 ++total_resource_count_; 130 ++total_resource_count_;
131 131
132 Resource* resource = pool_resource.get(); 132 Resource* resource = pool_resource.get();
133 in_use_resources_.set(resource->id(), pool_resource.Pass()); 133 in_use_resources_.set(resource->id(), std::move(pool_resource));
134 in_use_memory_usage_bytes_ += ResourceUtil::UncheckedSizeInBytes<size_t>( 134 in_use_memory_usage_bytes_ += ResourceUtil::UncheckedSizeInBytes<size_t>(
135 resource->size(), resource->format()); 135 resource->size(), resource->format());
136 return resource; 136 return resource;
137 } 137 }
138 138
139 Resource* ResourcePool::TryAcquireResourceWithContentId(uint64_t content_id) { 139 Resource* ResourcePool::TryAcquireResourceWithContentId(uint64_t content_id) {
140 DCHECK(content_id); 140 DCHECK(content_id);
141 141
142 auto it = 142 auto it =
143 std::find_if(unused_resources_.begin(), unused_resources_.end(), 143 std::find_if(unused_resources_.begin(), unused_resources_.end(),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // Remove lost resources from pool. 227 // Remove lost resources from pool.
228 DeleteResource(it->Pass()); 228 DeleteResource(it->Pass());
229 busy_resources_.erase(it); 229 busy_resources_.erase(it);
230 } else { 230 } else {
231 ++i; 231 ++i;
232 } 232 }
233 } 233 }
234 } 234 }
235 235
236 void ResourcePool::DidFinishUsingResource(scoped_ptr<PoolResource> resource) { 236 void ResourcePool::DidFinishUsingResource(scoped_ptr<PoolResource> resource) {
237 unused_resources_.push_front(resource.Pass()); 237 unused_resources_.push_front(std::move(resource));
238 } 238 }
239 239
240 void ResourcePool::ScheduleEvictExpiredResourcesIn( 240 void ResourcePool::ScheduleEvictExpiredResourcesIn(
241 base::TimeDelta time_from_now) { 241 base::TimeDelta time_from_now) {
242 if (evict_expired_resources_pending_) 242 if (evict_expired_resources_pending_)
243 return; 243 return;
244 244
245 evict_expired_resources_pending_ = true; 245 evict_expired_resources_pending_ = true;
246 246
247 task_runner_->PostDelayedTask(FROM_HERE, 247 task_runner_->PostDelayedTask(FROM_HERE,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 for (const auto& resource : busy_resources_) { 309 for (const auto& resource : busy_resources_) {
310 resource->OnMemoryDump(pmd, resource_provider_, false /* is_free */); 310 resource->OnMemoryDump(pmd, resource_provider_, false /* is_free */);
311 } 311 }
312 for (const auto& entry : in_use_resources_) { 312 for (const auto& entry : in_use_resources_) {
313 entry.second->OnMemoryDump(pmd, resource_provider_, false /* is_free */); 313 entry.second->OnMemoryDump(pmd, resource_provider_, false /* is_free */);
314 } 314 }
315 return true; 315 return true;
316 } 316 }
317 317
318 } // namespace cc 318 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quads/render_pass_unittest.cc ('k') | cc/resources/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698