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

Side by Side Diff: cc/CCResourceProvider.h

Issue 10915298: Add CCDelegatingRenderer, and corresponding IPCs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix clang Created 8 years, 2 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/CCRendererSoftware.cpp ('k') | cc/CCResourceProvider.cpp » ('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 CCResourceProvider_h 5 #ifndef CCResourceProvider_h
6 #define CCResourceProvider_h 6 #define CCResourceProvider_h
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "CCGraphicsContext.h" 9 #include "CCGraphicsContext.h"
10 #include "GraphicsContext3D.h" 10 #include "GraphicsContext3D.h"
(...skipping 10 matching lines...) Expand all
21 #include <wtf/Vector.h> 21 #include <wtf/Vector.h>
22 22
23 namespace WebKit { 23 namespace WebKit {
24 class WebGraphicsContext3D; 24 class WebGraphicsContext3D;
25 } 25 }
26 26
27 namespace cc { 27 namespace cc {
28 28
29 class IntRect; 29 class IntRect;
30 class LayerTextureSubImage; 30 class LayerTextureSubImage;
31 struct Mailbox;
31 class TextureCopier; 32 class TextureCopier;
32 class TextureUploader; 33 class TextureUploader;
34 struct TransferableResource;
35 struct TransferableResourceList;
33 36
34 // Thread-safety notes: this class is not thread-safe and can only be called 37 // Thread-safety notes: this class is not thread-safe and can only be called
35 // from the thread it was created on (in practice, the compositor thread). 38 // from the thread it was created on (in practice, the compositor thread).
36 class CCResourceProvider { 39 class CCResourceProvider {
37 public: 40 public:
38 typedef unsigned ResourceId; 41 typedef unsigned ResourceId;
39 typedef Vector<ResourceId> ResourceIdArray; 42 typedef Vector<ResourceId> ResourceIdArray;
40 typedef HashMap<ResourceId, ResourceId> ResourceIdMap; 43 typedef HashMap<ResourceId, ResourceId> ResourceIdMap;
41 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer }; 44 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer };
42 enum ResourceType { 45 enum ResourceType {
43 GLTexture = 1, 46 GLTexture = 1,
44 Bitmap, 47 Bitmap,
45 }; 48 };
46 struct Mailbox {
47 GC3Dbyte name[64];
48 };
49 struct TransferableResource {
50 unsigned id;
51 GC3Denum format;
52 IntSize size;
53 Mailbox mailbox;
54 };
55 typedef Vector<TransferableResource> TransferableResourceArray;
56 struct TransferableResourceList {
57 TransferableResourceList();
58 ~TransferableResourceList();
59
60 TransferableResourceArray resources;
61 unsigned syncPoint;
62 };
63
64 static PassOwnPtr<CCResourceProvider> create(CCGraphicsContext*); 49 static PassOwnPtr<CCResourceProvider> create(CCGraphicsContext*);
65 50
66 virtual ~CCResourceProvider(); 51 virtual ~CCResourceProvider();
67 52
53 CCGraphicsContext* context() const { return m_context; }
68 WebKit::WebGraphicsContext3D* graphicsContext3D(); 54 WebKit::WebGraphicsContext3D* graphicsContext3D();
69 TextureUploader* textureUploader() const { return m_textureUploader.get(); } 55 TextureUploader* textureUploader() const { return m_textureUploader.get(); }
70 TextureCopier* textureCopier() const { return m_textureCopier.get(); } 56 TextureCopier* textureCopier() const { return m_textureCopier.get(); }
71 int maxTextureSize() const { return m_maxTextureSize; } 57 int maxTextureSize() const { return m_maxTextureSize; }
72 unsigned numResources() const { return m_resources.size(); } 58 unsigned numResources() const { return m_resources.size(); }
73 59
74 // Checks whether a resource is in use by a consumer. 60 // Checks whether a resource is in use by a consumer.
75 bool inUseByConsumer(ResourceId); 61 bool inUseByConsumer(ResourceId);
76 62
77 63
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 int createChild(int pool); 97 int createChild(int pool);
112 98
113 // Destroys accounting for the child, deleting all resources from that pool. 99 // Destroys accounting for the child, deleting all resources from that pool.
114 void destroyChild(int child); 100 void destroyChild(int child);
115 101
116 // Gets the child->parent resource ID map. 102 // Gets the child->parent resource ID map.
117 const ResourceIdMap& getChildToParentMap(int child) const; 103 const ResourceIdMap& getChildToParentMap(int child) const;
118 104
119 // Prepares resources to be transfered to the parent, moving them to 105 // Prepares resources to be transfered to the parent, moving them to
120 // mailboxes and serializing meta-data into TransferableResources. 106 // mailboxes and serializing meta-data into TransferableResources.
121 // Resources are not removed from the CCResourceProvider, but are markes as 107 // Resources are not removed from the CCResourceProvider, but are marked as
122 // "in use". 108 // "in use".
123 TransferableResourceList prepareSendToParent(const ResourceIdArray&); 109 void prepareSendToParent(const ResourceIdArray&, TransferableResourceList*);
124 110
125 // Prepares resources to be transfered back to the child, moving them to 111 // Prepares resources to be transfered back to the child, moving them to
126 // mailboxes and serializing meta-data into TransferableResources. 112 // mailboxes and serializing meta-data into TransferableResources.
127 // Resources are removed from the CCResourceProvider. Note: the resource IDs 113 // Resources are removed from the CCResourceProvider. Note: the resource IDs
128 // passed are in the parent namespace and will be translated to the child 114 // passed are in the parent namespace and will be translated to the child
129 // namespace when returned. 115 // namespace when returned.
130 TransferableResourceList prepareSendToChild(int child, const ResourceIdArray &); 116 void prepareSendToChild(int child, const ResourceIdArray&, TransferableResou rceList*);
131 117
132 // Receives resources from a child, moving them from mailboxes. Resource IDs 118 // Receives resources from a child, moving them from mailboxes. Resource IDs
133 // passed are in the child namespace, and will be translated to the parent 119 // passed are in the child namespace, and will be translated to the parent
134 // namespace, added to the child->parent map. 120 // namespace, added to the child->parent map.
135 // NOTE: if the syncPoint filed in TransferableResourceList is set, this 121 // NOTE: if the syncPoint filed in TransferableResourceList is set, this
136 // will wait on it. 122 // will wait on it.
137 void receiveFromChild(int child, const TransferableResourceList&); 123 void receiveFromChild(int child, const TransferableResourceList&);
138 124
139 // Receives resources from the parent, moving them from mailboxes. Resource IDs 125 // Receives resources from the parent, moving them from mailboxes. Resource IDs
140 // passed are in the child namespace. 126 // passed are in the child namespace.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 Resource(unsigned textureId, int pool, const IntSize& size, GC3Denum for mat); 202 Resource(unsigned textureId, int pool, const IntSize& size, GC3Denum for mat);
217 Resource(uint8_t* pixels, int pool, const IntSize& size, GC3Denum format ); 203 Resource(uint8_t* pixels, int pool, const IntSize& size, GC3Denum format );
218 204
219 unsigned glId; 205 unsigned glId;
220 uint8_t* pixels; 206 uint8_t* pixels;
221 int pool; 207 int pool;
222 int lockForReadCount; 208 int lockForReadCount;
223 bool lockedForWrite; 209 bool lockedForWrite;
224 bool external; 210 bool external;
225 bool exported; 211 bool exported;
226 bool markedForDeletion; 212 bool deleted;
227 IntSize size; 213 IntSize size;
228 GC3Denum format; 214 GC3Denum format;
229 ResourceType type; 215 ResourceType type;
230 }; 216 };
231 typedef HashMap<ResourceId, Resource> ResourceMap; 217 typedef HashMap<ResourceId, Resource> ResourceMap;
232 struct Child { 218 struct Child {
233 Child(); 219 Child();
234 ~Child(); 220 ~Child();
235 221
236 int pool; 222 int pool;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 OwnPtr<TextureUploader> m_textureUploader; 254 OwnPtr<TextureUploader> m_textureUploader;
269 OwnPtr<AcceleratedTextureCopier> m_textureCopier; 255 OwnPtr<AcceleratedTextureCopier> m_textureCopier;
270 int m_maxTextureSize; 256 int m_maxTextureSize;
271 257
272 DISALLOW_COPY_AND_ASSIGN(CCResourceProvider); 258 DISALLOW_COPY_AND_ASSIGN(CCResourceProvider);
273 }; 259 };
274 260
275 } 261 }
276 262
277 #endif 263 #endif
OLDNEW
« no previous file with comments | « cc/CCRendererSoftware.cpp ('k') | cc/CCResourceProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698