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

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

Issue 142863008: Revert of [#7] Pass gfx structs by const ref (gfx::Size) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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_provider.h » ('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 "cc/resources/resource_provider.h" 7 #include "cc/resources/resource_provider.h"
8 #include "cc/resources/scoped_resource.h" 8 #include "cc/resources/scoped_resource.h"
9 9
10 namespace cc { 10 namespace cc {
(...skipping 17 matching lines...) Expand all
28 busy_resources_.pop_front(); 28 busy_resources_.pop_front();
29 } 29 }
30 30
31 SetResourceUsageLimits(0, 0, 0); 31 SetResourceUsageLimits(0, 0, 0);
32 DCHECK_EQ(0u, unused_resources_.size()); 32 DCHECK_EQ(0u, unused_resources_.size());
33 DCHECK_EQ(0u, memory_usage_bytes_); 33 DCHECK_EQ(0u, memory_usage_bytes_);
34 DCHECK_EQ(0u, unused_memory_usage_bytes_); 34 DCHECK_EQ(0u, unused_memory_usage_bytes_);
35 DCHECK_EQ(0u, resource_count_); 35 DCHECK_EQ(0u, resource_count_);
36 } 36 }
37 37
38 scoped_ptr<ScopedResource> ResourcePool::AcquireResource( 38 scoped_ptr<ScopedResource> ResourcePool::AcquireResource(gfx::Size size) {
39 const gfx::Size& size) {
40 for (ResourceList::iterator it = unused_resources_.begin(); 39 for (ResourceList::iterator it = unused_resources_.begin();
41 it != unused_resources_.end(); 40 it != unused_resources_.end();
42 ++it) { 41 ++it) {
43 ScopedResource* resource = *it; 42 ScopedResource* resource = *it;
44 DCHECK(resource_provider_->CanLockForWrite(resource->id())); 43 DCHECK(resource_provider_->CanLockForWrite(resource->id()));
45 44
46 if (resource->size() != size) 45 if (resource->size() != size)
47 continue; 46 continue;
48 47
49 unused_resources_.erase(it); 48 unused_resources_.erase(it);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 124 }
126 } 125 }
127 } 126 }
128 127
129 void ResourcePool::DidFinishUsingResource(ScopedResource* resource) { 128 void ResourcePool::DidFinishUsingResource(ScopedResource* resource) {
130 unused_memory_usage_bytes_ += resource->bytes(); 129 unused_memory_usage_bytes_ += resource->bytes();
131 unused_resources_.push_back(resource); 130 unused_resources_.push_back(resource);
132 } 131 }
133 132
134 } // namespace cc 133 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_pool.h ('k') | cc/resources/resource_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698