OLD | NEW |
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 { |
11 | 11 |
12 ResourcePool::ResourcePool(ResourceProvider* resource_provider, | 12 ResourcePool::ResourcePool(ResourceProvider* resource_provider, GLenum target) |
13 GLenum target, | |
14 ResourceFormat default_format) | |
15 : resource_provider_(resource_provider), | 13 : resource_provider_(resource_provider), |
16 target_(target), | 14 target_(target), |
17 default_format_(default_format), | |
18 max_memory_usage_bytes_(0), | 15 max_memory_usage_bytes_(0), |
19 max_unused_memory_usage_bytes_(0), | 16 max_unused_memory_usage_bytes_(0), |
20 max_resource_count_(0), | 17 max_resource_count_(0), |
21 memory_usage_bytes_(0), | 18 memory_usage_bytes_(0), |
22 unused_memory_usage_bytes_(0), | 19 unused_memory_usage_bytes_(0), |
23 resource_count_(0) {} | 20 resource_count_(0) {} |
24 | 21 |
25 ResourcePool::~ResourcePool() { | 22 ResourcePool::~ResourcePool() { |
26 while (!busy_resources_.empty()) { | 23 while (!busy_resources_.empty()) { |
27 DidFinishUsingResource(busy_resources_.front()); | 24 DidFinishUsingResource(busy_resources_.front()); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 121 } |
125 } | 122 } |
126 } | 123 } |
127 | 124 |
128 void ResourcePool::DidFinishUsingResource(ScopedResource* resource) { | 125 void ResourcePool::DidFinishUsingResource(ScopedResource* resource) { |
129 unused_memory_usage_bytes_ += resource->bytes(); | 126 unused_memory_usage_bytes_ += resource->bytes(); |
130 unused_resources_.push_back(resource); | 127 unused_resources_.push_back(resource); |
131 } | 128 } |
132 | 129 |
133 } // namespace cc | 130 } // namespace cc |
OLD | NEW |