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

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

Issue 43753002: cc: Keep track of busy resources in ResourcePool (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc: Keep track of busy resources in ResourcePool Created 7 years, 1 month 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 | « no previous file | cc/resources/resource_pool.cc » ('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 #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 <list> 8 #include <list>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 27 matching lines...) Expand all
38 38
39 scoped_ptr<ResourcePool::Resource> AcquireResource( 39 scoped_ptr<ResourcePool::Resource> AcquireResource(
40 gfx::Size size, ResourceFormat format); 40 gfx::Size size, ResourceFormat format);
41 void ReleaseResource(scoped_ptr<ResourcePool::Resource>); 41 void ReleaseResource(scoped_ptr<ResourcePool::Resource>);
42 42
43 void SetResourceUsageLimits(size_t max_memory_usage_bytes, 43 void SetResourceUsageLimits(size_t max_memory_usage_bytes,
44 size_t max_unused_memory_usage_bytes, 44 size_t max_unused_memory_usage_bytes,
45 size_t max_resource_count); 45 size_t max_resource_count);
46 46
47 void ReduceResourceUsage(); 47 void ReduceResourceUsage();
48 void CheckBusyResources();
48 49
49 size_t total_memory_usage_bytes() const { 50 size_t total_memory_usage_bytes() const {
50 return memory_usage_bytes_; 51 return memory_usage_bytes_;
51 } 52 }
52 size_t acquired_memory_usage_bytes() const { 53 size_t acquired_memory_usage_bytes() const {
53 return memory_usage_bytes_ - unused_memory_usage_bytes_; 54 return memory_usage_bytes_ - unused_memory_usage_bytes_;
54 } 55 }
55 size_t acquired_resource_count() const { 56 size_t acquired_resource_count() const {
56 return resource_count_ - unused_resources_.size(); 57 return resource_count_ - unused_resources_.size();
57 } 58 }
58 59
59 protected: 60 protected:
60 explicit ResourcePool(ResourceProvider* resource_provider); 61 explicit ResourcePool(ResourceProvider* resource_provider);
61 62
62 bool ResourceUsageTooHigh(); 63 bool ResourceUsageTooHigh();
63 64
64 private: 65 private:
65 ResourceProvider* resource_provider_; 66 ResourceProvider* resource_provider_;
66 size_t max_memory_usage_bytes_; 67 size_t max_memory_usage_bytes_;
67 size_t max_unused_memory_usage_bytes_; 68 size_t max_unused_memory_usage_bytes_;
68 size_t max_resource_count_; 69 size_t max_resource_count_;
69 size_t memory_usage_bytes_; 70 size_t memory_usage_bytes_;
70 size_t unused_memory_usage_bytes_; 71 size_t unused_memory_usage_bytes_;
71 size_t resource_count_; 72 size_t resource_count_;
72 73
73 typedef std::list<Resource*> ResourceList; 74 typedef std::list<Resource*> ResourceList;
74 ResourceList unused_resources_; 75 ResourceList unused_resources_;
76 ResourceList busy_resources_;
75 77
76 DISALLOW_COPY_AND_ASSIGN(ResourcePool); 78 DISALLOW_COPY_AND_ASSIGN(ResourcePool);
77 }; 79 };
78 80
79 } // namespace cc 81 } // namespace cc
80 82
81 #endif // CC_RESOURCES_RESOURCE_POOL_H_ 83 #endif // CC_RESOURCES_RESOURCE_POOL_H_
OLDNEW
« no previous file with comments | « no previous file | cc/resources/resource_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698