| 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 #ifndef CC_RESOURCES_RESOURCE_POOL_H_ | 5 #ifndef CC_RESOURCES_RESOURCE_POOL_H_ |
| 6 #define CC_RESOURCES_RESOURCE_POOL_H_ | 6 #define CC_RESOURCES_RESOURCE_POOL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 static std::unique_ptr<ResourcePool> Create( | 38 static std::unique_ptr<ResourcePool> Create( |
| 39 ResourceProvider* resource_provider, | 39 ResourceProvider* resource_provider, |
| 40 base::SingleThreadTaskRunner* task_runner) { | 40 base::SingleThreadTaskRunner* task_runner) { |
| 41 return base::WrapUnique( | 41 return base::WrapUnique( |
| 42 new ResourcePool(resource_provider, task_runner, false)); | 42 new ResourcePool(resource_provider, task_runner, false)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 ~ResourcePool() override; | 45 ~ResourcePool() override; |
| 46 | 46 |
| 47 // Tries to reuse a resource. Returns |nullptr| if none are available. | 47 // Tries to reuse a resource as close to |min_size| as possible. The |
| 48 Resource* ReuseResource(const gfx::Size& size, | 48 // resource will never exceed |max_size|. Returns |nullptr| if none are |
| 49 // available. |
| 50 Resource* ReuseResource(const gfx::Size& min_size, |
| 51 const gfx::Size& max_size, |
| 49 ResourceFormat format, | 52 ResourceFormat format, |
| 50 const gfx::ColorSpace& color_space); | 53 const gfx::ColorSpace& color_space); |
| 51 | 54 |
| 52 // Creates a new resource without trying to reuse an old one. | 55 // Creates a new resource without trying to reuse an old one. |
| 53 Resource* CreateResource(const gfx::Size& size, | 56 Resource* CreateResource(const gfx::Size& size, |
| 54 ResourceFormat format, | 57 ResourceFormat format, |
| 55 const gfx::ColorSpace& color_space); | 58 const gfx::ColorSpace& color_space); |
| 56 | 59 |
| 57 // Tries to reuse a resource. If none are available, makes a new one. | 60 // Tries to reuse a resource. If none are available, makes a new one. |
| 58 Resource* AcquireResource(const gfx::Size& size, | 61 Resource* AcquireResource(const gfx::Size& size, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 base::TimeDelta resource_expiration_delay_; | 175 base::TimeDelta resource_expiration_delay_; |
| 173 | 176 |
| 174 base::WeakPtrFactory<ResourcePool> weak_ptr_factory_; | 177 base::WeakPtrFactory<ResourcePool> weak_ptr_factory_; |
| 175 | 178 |
| 176 DISALLOW_COPY_AND_ASSIGN(ResourcePool); | 179 DISALLOW_COPY_AND_ASSIGN(ResourcePool); |
| 177 }; | 180 }; |
| 178 | 181 |
| 179 } // namespace cc | 182 } // namespace cc |
| 180 | 183 |
| 181 #endif // CC_RESOURCES_RESOURCE_POOL_H_ | 184 #endif // CC_RESOURCES_RESOURCE_POOL_H_ |
| OLD | NEW |