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

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

Issue 1282183002: 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, 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 180 }
181 181
182 void ResourcePool::DeleteResource(ScopedResource* resource) { 182 void ResourcePool::DeleteResource(ScopedResource* resource) {
183 size_t resource_bytes = ResourceUtil::UncheckedSizeInBytes<size_t>( 183 size_t resource_bytes = ResourceUtil::UncheckedSizeInBytes<size_t>(
184 resource->size(), resource->format()); 184 resource->size(), resource->format());
185 memory_usage_bytes_ -= resource_bytes; 185 memory_usage_bytes_ -= resource_bytes;
186 --resource_count_; 186 --resource_count_;
187 delete resource; 187 delete resource;
188 } 188 }
189 189
190 void ResourcePool::CheckBusyResources() { 190 void ResourcePool::CheckBusyResources(bool wait_if_needed) {
191 ResourceList::iterator it = busy_resources_.begin(); 191 ResourceList::iterator it = busy_resources_.begin();
192 192
193 while (it != busy_resources_.end()) { 193 while (it != busy_resources_.end()) {
194 ScopedResource* resource = it->resource; 194 ScopedResource* resource = it->resource;
195 195
196 if (wait_if_needed)
197 resource_provider_->WaitReadLockIfNeeded(resource->id());
198
196 if (resource_provider_->CanLockForWrite(resource->id())) { 199 if (resource_provider_->CanLockForWrite(resource->id())) {
197 DidFinishUsingResource(resource, it->content_id); 200 DidFinishUsingResource(resource, it->content_id);
198 it = busy_resources_.erase(it); 201 it = busy_resources_.erase(it);
199 } else if (resource_provider_->IsLost(resource->id())) { 202 } else if (resource_provider_->IsLost(resource->id())) {
200 // Remove lost resources from pool. 203 // Remove lost resources from pool.
201 DeleteResource(resource); 204 DeleteResource(resource);
202 it = busy_resources_.erase(it); 205 it = busy_resources_.erase(it);
203 } else { 206 } else {
204 ++it; 207 ++it;
205 } 208 }
(...skipping 14 matching lines...) Expand all
220 } 223 }
221 for (const auto& resource : busy_resources_) { 224 for (const auto& resource : busy_resources_) {
222 resource.OnMemoryDump(pmd, false /* is_free */); 225 resource.OnMemoryDump(pmd, false /* is_free */);
223 } 226 }
224 // TODO(ericrk): Dump vended out resources once that data is available. 227 // TODO(ericrk): Dump vended out resources once that data is available.
225 // crbug.com/516541 228 // crbug.com/516541
226 return true; 229 return true;
227 } 230 }
228 231
229 } // namespace cc 232 } // 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