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

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

Issue 1251693003: cc: Fix the format of GpuMemoryBuffer for SurfaceTexture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 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 | « 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 <deque> 8 #include <deque>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/trace_event/memory_dump_provider.h" 11 #include "base/trace_event/memory_dump_provider.h"
12 #include "cc/base/cc_export.h" 12 #include "cc/base/cc_export.h"
13 #include "cc/output/renderer.h" 13 #include "cc/output/renderer.h"
14 #include "cc/resources/resource.h" 14 #include "cc/resources/resource.h"
15 #include "cc/resources/resource_format.h" 15 #include "cc/resources/resource_format.h"
16 16
17 namespace cc { 17 namespace cc {
18 class ScopedResource; 18 class ScopedResource;
19 19
20 class CC_EXPORT ResourcePool : public base::trace_event::MemoryDumpProvider { 20 class CC_EXPORT ResourcePool : public base::trace_event::MemoryDumpProvider {
21 public: 21 public:
22 static scoped_ptr<ResourcePool> Create(ResourceProvider* resource_provider) {
23 return make_scoped_ptr(new ResourcePool(resource_provider));
24 }
25
22 static scoped_ptr<ResourcePool> Create(ResourceProvider* resource_provider, 26 static scoped_ptr<ResourcePool> Create(ResourceProvider* resource_provider,
23 GLenum target) { 27 GLenum target) {
24 return make_scoped_ptr(new ResourcePool(resource_provider, target)); 28 return make_scoped_ptr(new ResourcePool(resource_provider, target));
25 } 29 }
26 30
27 ~ResourcePool() override; 31 ~ResourcePool() override;
28 32
29 scoped_ptr<ScopedResource> AcquireResource(const gfx::Size& size, 33 scoped_ptr<ScopedResource> AcquireResource(const gfx::Size& size,
30 ResourceFormat format); 34 ResourceFormat format);
31 scoped_ptr<ScopedResource> TryAcquireResourceWithContentId(uint64 content_id); 35 scoped_ptr<ScopedResource> TryAcquireResourceWithContentId(uint64 content_id);
(...skipping 18 matching lines...) Expand all
50 size_t acquired_resource_count() const { 54 size_t acquired_resource_count() const {
51 return resource_count_ - unused_resources_.size(); 55 return resource_count_ - unused_resources_.size();
52 } 56 }
53 size_t busy_resource_count() const { return busy_resources_.size(); } 57 size_t busy_resource_count() const { return busy_resources_.size(); }
54 58
55 // Overridden from base::trace_event::MemoryDumpProvider: 59 // Overridden from base::trace_event::MemoryDumpProvider:
56 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 60 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
57 base::trace_event::ProcessMemoryDump* pmd) override; 61 base::trace_event::ProcessMemoryDump* pmd) override;
58 62
59 protected: 63 protected:
64 explicit ResourcePool(ResourceProvider* resource_provider);
60 ResourcePool(ResourceProvider* resource_provider, GLenum target); 65 ResourcePool(ResourceProvider* resource_provider, GLenum target);
61 66
62 bool ResourceUsageTooHigh(); 67 bool ResourceUsageTooHigh();
63 68
64 private: 69 private:
65 void DidFinishUsingResource(ScopedResource* resource, uint64_t content_id); 70 void DidFinishUsingResource(ScopedResource* resource, uint64_t content_id);
66 void DeleteResource(ScopedResource* resource); 71 void DeleteResource(ScopedResource* resource);
67 72
68 ResourceProvider* resource_provider_; 73 ResourceProvider* resource_provider_;
69 const GLenum target_; 74 const GLenum target_;
(...skipping 16 matching lines...) Expand all
86 typedef std::deque<PoolResource> ResourceList; 91 typedef std::deque<PoolResource> ResourceList;
87 ResourceList unused_resources_; 92 ResourceList unused_resources_;
88 ResourceList busy_resources_; 93 ResourceList busy_resources_;
89 94
90 DISALLOW_COPY_AND_ASSIGN(ResourcePool); 95 DISALLOW_COPY_AND_ASSIGN(ResourcePool);
91 }; 96 };
92 97
93 } // namespace cc 98 } // namespace cc
94 99
95 #endif // CC_RESOURCES_RESOURCE_POOL_H_ 100 #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