| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 // Called when a resource's content has been fully replaced (and is completely | 58 // Called when a resource's content has been fully replaced (and is completely |
| 59 // valid). Updates the resource's content ID to its new value. | 59 // valid). Updates the resource's content ID to its new value. |
| 60 void OnContentReplaced(ResourceId resource_id, uint64_t content_id); | 60 void OnContentReplaced(ResourceId resource_id, uint64_t content_id); |
| 61 void ReleaseResource(Resource* resource); | 61 void ReleaseResource(Resource* resource); |
| 62 | 62 |
| 63 void SetResourceUsageLimits(size_t max_memory_usage_bytes, | 63 void SetResourceUsageLimits(size_t max_memory_usage_bytes, |
| 64 size_t max_resource_count); | 64 size_t max_resource_count); |
| 65 | 65 |
| 66 void ReduceResourceUsage(); | 66 void ReduceResourceUsage(); |
| 67 |
| 68 // Must be called regularly to move resources from the busy pool to the unused |
| 69 // pool. |
| 67 void CheckBusyResources(); | 70 void CheckBusyResources(); |
| 68 | 71 |
| 69 size_t memory_usage_bytes() const { return in_use_memory_usage_bytes_; } | 72 size_t memory_usage_bytes() const { return in_use_memory_usage_bytes_; } |
| 70 size_t resource_count() const { return in_use_resources_.size(); } | 73 size_t resource_count() const { return in_use_resources_.size(); } |
| 71 | 74 |
| 72 // Overridden from base::trace_event::MemoryDumpProvider: | 75 // Overridden from base::trace_event::MemoryDumpProvider: |
| 73 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 76 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
| 74 base::trace_event::ProcessMemoryDump* pmd) override; | 77 base::trace_event::ProcessMemoryDump* pmd) override; |
| 75 | 78 |
| 76 size_t GetTotalMemoryUsageForTesting() const { | 79 size_t GetTotalMemoryUsageForTesting() const { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 base::TimeDelta resource_expiration_delay_; | 162 base::TimeDelta resource_expiration_delay_; |
| 160 | 163 |
| 161 base::WeakPtrFactory<ResourcePool> weak_ptr_factory_; | 164 base::WeakPtrFactory<ResourcePool> weak_ptr_factory_; |
| 162 | 165 |
| 163 DISALLOW_COPY_AND_ASSIGN(ResourcePool); | 166 DISALLOW_COPY_AND_ASSIGN(ResourcePool); |
| 164 }; | 167 }; |
| 165 | 168 |
| 166 } // namespace cc | 169 } // namespace cc |
| 167 | 170 |
| 168 #endif // CC_RESOURCES_RESOURCE_POOL_H_ | 171 #endif // CC_RESOURCES_RESOURCE_POOL_H_ |
| OLD | NEW |