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

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

Issue 15715031: cc: Remove memory state from tile management (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 7 years, 6 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/picture_layer_tiling_set_unittest.cc ('k') | cc/resources/tile.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 #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 28 matching lines...) Expand all
39 ResourceProvider* resource_provider() { return resource_provider_; } 39 ResourceProvider* resource_provider() { return resource_provider_; }
40 40
41 scoped_ptr<ResourcePool::Resource> AcquireResource(gfx::Size size, 41 scoped_ptr<ResourcePool::Resource> AcquireResource(gfx::Size size,
42 GLenum format); 42 GLenum format);
43 void ReleaseResource(scoped_ptr<ResourcePool::Resource>); 43 void ReleaseResource(scoped_ptr<ResourcePool::Resource>);
44 44
45 void SetMaxMemoryUsageBytes( 45 void SetMaxMemoryUsageBytes(
46 size_t max_memory_usage_bytes, 46 size_t max_memory_usage_bytes,
47 size_t max_unused_memory_usage_bytes); 47 size_t max_unused_memory_usage_bytes);
48 48
49 size_t acquired_memory_usage_bytes() const {
50 return memory_usage_bytes_ - unused_memory_usage_bytes_;
51 }
52
49 protected: 53 protected:
50 explicit ResourcePool(ResourceProvider* resource_provider); 54 explicit ResourcePool(ResourceProvider* resource_provider);
51 55
52 bool MemoryUsageTooHigh(); 56 bool MemoryUsageTooHigh();
53 57
54 private: 58 private:
55 ResourceProvider* resource_provider_; 59 ResourceProvider* resource_provider_;
56 size_t max_memory_usage_bytes_; 60 size_t max_memory_usage_bytes_;
57 size_t max_unused_memory_usage_bytes_; 61 size_t max_unused_memory_usage_bytes_;
58 size_t memory_usage_bytes_; 62 size_t memory_usage_bytes_;
59 size_t unused_memory_usage_bytes_; 63 size_t unused_memory_usage_bytes_;
60 64
61 typedef std::list<Resource*> ResourceList; 65 typedef std::list<Resource*> ResourceList;
62 ResourceList resources_; 66 ResourceList resources_;
63 67
64 DISALLOW_COPY_AND_ASSIGN(ResourcePool); 68 DISALLOW_COPY_AND_ASSIGN(ResourcePool);
65 }; 69 };
66 70
67 } // namespace cc 71 } // namespace cc
68 72
69 #endif // CC_RESOURCES_RESOURCE_POOL_H_ 73 #endif // CC_RESOURCES_RESOURCE_POOL_H_
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling_set_unittest.cc ('k') | cc/resources/tile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698