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

Side by Side Diff: cc/resource_pool.h

Issue 12471007: Part 8 of cc/ directory shuffles: resources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/resource.cc ('k') | cc/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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_RESOURCE_POOL_H_
6 #define CC_RESOURCE_POOL_H_
7
8 #include <list>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/base/cc_export.h"
12 #include "cc/output/renderer.h"
13 #include "cc/resource.h"
14
15 namespace cc {
16 class ResourceProvider;
17
18 class CC_EXPORT ResourcePool {
19 public:
20 class CC_EXPORT Resource : public cc::Resource {
21 public:
22 Resource(ResourceProvider* resource_provider,
23 const gfx::Size& size,
24 GLenum format);
25 ~Resource();
26
27 private:
28 ResourceProvider* resource_provider_;
29
30 DISALLOW_COPY_AND_ASSIGN(Resource);
31 };
32
33 static scoped_ptr<ResourcePool> Create(ResourceProvider* resource_provider) {
34 return make_scoped_ptr(new ResourcePool(resource_provider));
35 }
36
37 virtual ~ResourcePool();
38
39 ResourceProvider* resource_provider() { return resource_provider_; };
40
41 scoped_ptr<ResourcePool::Resource> AcquireResource(
42 const gfx::Size&, GLenum format);
43 void ReleaseResource(scoped_ptr<ResourcePool::Resource>);
44
45 void SetMaxMemoryUsageBytes(size_t max_memory_usage_bytes);
46
47 protected:
48 ResourcePool(ResourceProvider* resource_provider);
49
50 private:
51 ResourceProvider* resource_provider_;
52 size_t max_memory_usage_bytes_;
53 size_t memory_usage_bytes_;
54
55 typedef std::list<Resource*> ResourceList;
56 ResourceList resources_;
57
58 DISALLOW_COPY_AND_ASSIGN(ResourcePool);
59 };
60
61 } // namespace cc
62
63 #endif // CC_RESOURCE_POOL_H_
OLDNEW
« no previous file with comments | « cc/resource.cc ('k') | cc/resource_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698