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

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

Issue 1230203007: Re-land: cc: Use worker context for one-copy tile initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « cc/resources/resource_pool.h ('k') | cc/resources/resource_pool_unittest.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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 return false; 198 return false;
199 } 199 }
200 200
201 void ResourcePool::DeleteResource(scoped_ptr<PoolResource> resource) { 201 void ResourcePool::DeleteResource(scoped_ptr<PoolResource> resource) {
202 size_t resource_bytes = ResourceUtil::UncheckedSizeInBytes<size_t>( 202 size_t resource_bytes = ResourceUtil::UncheckedSizeInBytes<size_t>(
203 resource->size(), resource->format()); 203 resource->size(), resource->format());
204 memory_usage_bytes_ -= resource_bytes; 204 memory_usage_bytes_ -= resource_bytes;
205 --resource_count_; 205 --resource_count_;
206 } 206 }
207 207
208 void ResourcePool::CheckBusyResources(bool wait_if_needed) { 208 void ResourcePool::CheckBusyResources() {
209 for (size_t i = 0; i < busy_resources_.size();) { 209 for (size_t i = 0; i < busy_resources_.size();) {
210 ResourceDeque::iterator it(busy_resources_.begin() + i); 210 ResourceDeque::iterator it(busy_resources_.begin() + i);
211 PoolResource* resource = *it; 211 PoolResource* resource = *it;
212 212
213 if (wait_if_needed)
214 resource_provider_->WaitReadLockIfNeeded(resource->id());
215
216 if (resource_provider_->CanLockForWrite(resource->id())) { 213 if (resource_provider_->CanLockForWrite(resource->id())) {
217 DidFinishUsingResource(busy_resources_.take(it)); 214 DidFinishUsingResource(busy_resources_.take(it));
218 } else if (resource_provider_->IsLost(resource->id())) { 215 } else if (resource_provider_->IsLost(resource->id())) {
219 // Remove lost resources from pool. 216 // Remove lost resources from pool.
220 DeleteResource(busy_resources_.take(it)); 217 DeleteResource(busy_resources_.take(it));
221 } else { 218 } else {
222 ++i; 219 ++i;
223 } 220 }
224 } 221 }
225 } 222 }
(...skipping 12 matching lines...) Expand all
238 for (const auto& resource : busy_resources_) { 235 for (const auto& resource : busy_resources_) {
239 resource->OnMemoryDump(pmd, resource_provider_, false /* is_free */); 236 resource->OnMemoryDump(pmd, resource_provider_, false /* is_free */);
240 } 237 }
241 for (const auto& entry : in_use_resources_) { 238 for (const auto& entry : in_use_resources_) {
242 entry.second->OnMemoryDump(pmd, resource_provider_, false /* is_free */); 239 entry.second->OnMemoryDump(pmd, resource_provider_, false /* is_free */);
243 } 240 }
244 return true; 241 return true;
245 } 242 }
246 243
247 } // namespace cc 244 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_pool.h ('k') | cc/resources/resource_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698