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

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

Issue 1379783002: Allow one-copy task tile worker pool to use compressed textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 5 years 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
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 SetResourceUsageLimits(0, 0); 86 SetResourceUsageLimits(0, 0);
87 DCHECK_EQ(0u, unused_resources_.size()); 87 DCHECK_EQ(0u, unused_resources_.size());
88 DCHECK_EQ(0u, in_use_memory_usage_bytes_); 88 DCHECK_EQ(0u, in_use_memory_usage_bytes_);
89 DCHECK_EQ(0u, total_memory_usage_bytes_); 89 DCHECK_EQ(0u, total_memory_usage_bytes_);
90 DCHECK_EQ(0u, total_resource_count_); 90 DCHECK_EQ(0u, total_resource_count_);
91 } 91 }
92 92
93 Resource* ResourcePool::AcquireResource(const gfx::Size& size, 93 Resource* ResourcePool::AcquireResource(const gfx::Size& size,
94 ResourceFormat format) { 94 ResourceFormat format) {
95 DCHECK_EQ(size.width() % 4, 0);
96 DCHECK_EQ(size.height() % 4, 0);
97
95 // Finding resources in |unused_resources_| from MRU to LRU direction, touches 98 // Finding resources in |unused_resources_| from MRU to LRU direction, touches
96 // LRU resources only if needed, which increases possibility of expiring more 99 // LRU resources only if needed, which increases possibility of expiring more
97 // LRU resources within kResourceExpirationDelayMs. 100 // LRU resources within kResourceExpirationDelayMs.
98 for (ResourceDeque::iterator it = unused_resources_.begin(); 101 for (ResourceDeque::iterator it = unused_resources_.begin();
99 it != unused_resources_.end(); ++it) { 102 it != unused_resources_.end(); ++it) {
100 ScopedResource* resource = it->get(); 103 ScopedResource* resource = it->get();
101 DCHECK(resource_provider_->CanLockForWrite(resource->id())); 104 DCHECK(resource_provider_->CanLockForWrite(resource->id()));
102 105
103 if (resource->format() != format) 106 if (resource->format() != format)
104 continue; 107 continue;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 for (const auto& resource : busy_resources_) { 313 for (const auto& resource : busy_resources_) {
311 resource->OnMemoryDump(pmd, resource_provider_, false /* is_free */); 314 resource->OnMemoryDump(pmd, resource_provider_, false /* is_free */);
312 } 315 }
313 for (const auto& entry : in_use_resources_) { 316 for (const auto& entry : in_use_resources_) {
314 entry.second->OnMemoryDump(pmd, resource_provider_, false /* is_free */); 317 entry.second->OnMemoryDump(pmd, resource_provider_, false /* is_free */);
315 } 318 }
316 return true; 319 return true;
317 } 320 }
318 321
319 } // namespace cc 322 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698