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

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

Issue 1336703002: Revert of Re-land: cc: Use worker context for one-copy tile initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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() { 208 void ResourcePool::CheckBusyResources(bool wait_if_needed) {
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
213 if (resource_provider_->CanLockForWrite(resource->id())) { 216 if (resource_provider_->CanLockForWrite(resource->id())) {
214 DidFinishUsingResource(busy_resources_.take(it)); 217 DidFinishUsingResource(busy_resources_.take(it));
215 } else if (resource_provider_->IsLost(resource->id())) { 218 } else if (resource_provider_->IsLost(resource->id())) {
216 // Remove lost resources from pool. 219 // Remove lost resources from pool.
217 DeleteResource(busy_resources_.take(it)); 220 DeleteResource(busy_resources_.take(it));
218 } else { 221 } else {
219 ++i; 222 ++i;
220 } 223 }
221 } 224 }
222 } 225 }
(...skipping 12 matching lines...) Expand all
235 for (const auto& resource : busy_resources_) { 238 for (const auto& resource : busy_resources_) {
236 resource->OnMemoryDump(pmd, resource_provider_, false /* is_free */); 239 resource->OnMemoryDump(pmd, resource_provider_, false /* is_free */);
237 } 240 }
238 for (const auto& entry : in_use_resources_) { 241 for (const auto& entry : in_use_resources_) {
239 entry.second->OnMemoryDump(pmd, resource_provider_, false /* is_free */); 242 entry.second->OnMemoryDump(pmd, resource_provider_, false /* is_free */);
240 } 243 }
241 return true; 244 return true;
242 } 245 }
243 246
244 } // namespace cc 247 } // 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