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

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

Issue 147603006: [#7] Resubmitted - Pass gfx structs by const ref (gfx::Size) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resubmit 145313006 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(gfx::Size size) { 38 scoped_ptr<ScopedResource> ResourcePool::AcquireResource(
39 const gfx::Size& size) {
39 for (ResourceList::iterator it = unused_resources_.begin(); 40 for (ResourceList::iterator it = unused_resources_.begin();
40 it != unused_resources_.end(); 41 it != unused_resources_.end();
41 ++it) { 42 ++it) {
42 ScopedResource* resource = *it; 43 ScopedResource* resource = *it;
43 DCHECK(resource_provider_->CanLockForWrite(resource->id())); 44 DCHECK(resource_provider_->CanLockForWrite(resource->id()));
44 45
45 if (resource->size() != size) 46 if (resource->size() != size)
46 continue; 47 continue;
47 48
48 unused_resources_.erase(it); 49 unused_resources_.erase(it);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 125 }
125 } 126 }
126 } 127 }
127 128
128 void ResourcePool::DidFinishUsingResource(ScopedResource* resource) { 129 void ResourcePool::DidFinishUsingResource(ScopedResource* resource) {
129 unused_memory_usage_bytes_ += resource->bytes(); 130 unused_memory_usage_bytes_ += resource->bytes();
130 unused_resources_.push_back(resource); 131 unused_resources_.push_back(resource);
131 } 132 }
132 133
133 } // namespace cc 134 } // 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