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

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

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