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

Side by Side Diff: cc/resource_provider.h

Issue 11358080: Separate TransferableResource into own header (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unused accessor Created 8 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 | Annotate | Revision Log
« cc/DEPS ('K') | « cc/cc.gyp ('k') | cc/resource_provider.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 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 "base/hash_tables.h" 9 #include "base/hash_tables.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "cc/cc_export.h" 11 #include "cc/cc_export.h"
12 #include "cc/graphics_context.h" 12 #include "cc/graphics_context.h"
13 #include "cc/texture_copier.h" 13 #include "cc/texture_copier.h"
14 #include "cc/transferable_resource.h"
14 #include "third_party/khronos/GLES2/gl2.h" 15 #include "third_party/khronos/GLES2/gl2.h"
15 #include "third_party/skia/include/core/SkBitmap.h" 16 #include "third_party/skia/include/core/SkBitmap.h"
16 #include "third_party/skia/include/core/SkCanvas.h" 17 #include "third_party/skia/include/core/SkCanvas.h"
17 #include "ui/gfx/size.h" 18 #include "ui/gfx/size.h"
18 #include <deque> 19 #include <deque>
19 #include <vector> 20 #include <vector>
20 21
21 namespace WebKit { 22 namespace WebKit {
22 class WebGraphicsContext3D; 23 class WebGraphicsContext3D;
23 } 24 }
(...skipping 12 matching lines...) Expand all
36 class CC_EXPORT ResourceProvider { 37 class CC_EXPORT ResourceProvider {
37 public: 38 public:
38 typedef unsigned ResourceId; 39 typedef unsigned ResourceId;
39 typedef std::vector<ResourceId> ResourceIdArray; 40 typedef std::vector<ResourceId> ResourceIdArray;
40 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; 41 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap;
41 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer }; 42 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer };
42 enum ResourceType { 43 enum ResourceType {
43 GLTexture = 1, 44 GLTexture = 1,
44 Bitmap, 45 Bitmap,
45 }; 46 };
46 struct Mailbox {
47 GLbyte name[64];
48 };
49 struct TransferableResource {
50 unsigned id;
51 GLenum format;
52 gfx::Size size;
53 Mailbox mailbox;
54 };
55 typedef std::vector<TransferableResource> TransferableResourceArray;
56 struct CC_EXPORT TransferableResourceList {
57 TransferableResourceList();
58 ~TransferableResourceList();
59
60 TransferableResourceArray resources;
61 unsigned syncPoint;
62 };
63 47
64 static scoped_ptr<ResourceProvider> create(GraphicsContext*); 48 static scoped_ptr<ResourceProvider> create(GraphicsContext*);
65 49
66 virtual ~ResourceProvider(); 50 virtual ~ResourceProvider();
67 51
68 WebKit::WebGraphicsContext3D* graphicsContext3D(); 52 WebKit::WebGraphicsContext3D* graphicsContext3D();
69 TextureCopier* textureCopier() const { return m_textureCopier.get(); } 53 TextureCopier* textureCopier() const { return m_textureCopier.get(); }
70 int maxTextureSize() const { return m_maxTextureSize; } 54 int maxTextureSize() const { return m_maxTextureSize; }
71 unsigned numResources() const { return m_resources.size(); } 55 unsigned numResources() const { return m_resources.size(); }
72 56
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 int createChild(int pool); 99 int createChild(int pool);
116 100
117 // Destroys accounting for the child, deleting all resources from that pool. 101 // Destroys accounting for the child, deleting all resources from that pool.
118 void destroyChild(int child); 102 void destroyChild(int child);
119 103
120 // Gets the child->parent resource ID map. 104 // Gets the child->parent resource ID map.
121 const ResourceIdMap& getChildToParentMap(int child) const; 105 const ResourceIdMap& getChildToParentMap(int child) const;
122 106
123 // Prepares resources to be transfered to the parent, moving them to 107 // Prepares resources to be transfered to the parent, moving them to
124 // mailboxes and serializing meta-data into TransferableResources. 108 // mailboxes and serializing meta-data into TransferableResources.
125 // Resources are not removed from the ResourceProvider, but are markes as 109 // Resources are not removed from the ResourceProvider, but are marked as
126 // "in use". 110 // "in use".
127 TransferableResourceList prepareSendToParent(const ResourceIdArray&); 111 void prepareSendToParent(const ResourceIdArray&, TransferableResourceList*);
128 112
129 // Prepares resources to be transfered back to the child, moving them to 113 // Prepares resources to be transfered back to the child, moving them to
130 // mailboxes and serializing meta-data into TransferableResources. 114 // mailboxes and serializing meta-data into TransferableResources.
131 // Resources are removed from the ResourceProvider. Note: the resource IDs 115 // Resources are removed from the ResourceProvider. Note: the resource IDs
132 // passed are in the parent namespace and will be translated to the child 116 // passed are in the parent namespace and will be translated to the child
133 // namespace when returned. 117 // namespace when returned.
134 TransferableResourceList prepareSendToChild(int child, const ResourceIdArray &); 118 void prepareSendToChild(int child, const ResourceIdArray&, TransferableResou rceList*);
135 119
136 // Receives resources from a child, moving them from mailboxes. Resource IDs 120 // Receives resources from a child, moving them from mailboxes. Resource IDs
137 // passed are in the child namespace, and will be translated to the parent 121 // passed are in the child namespace, and will be translated to the parent
138 // namespace, added to the child->parent map. 122 // namespace, added to the child->parent map.
139 // NOTE: if the syncPoint filed in TransferableResourceList is set, this 123 // NOTE: if the syncPoint filed in TransferableResourceList is set, this
140 // will wait on it. 124 // will wait on it.
141 void receiveFromChild(int child, const TransferableResourceList&); 125 void receiveFromChild(int child, const TransferableResourceList&);
142 126
143 // Receives resources from the parent, moving them from mailboxes. Resource IDs 127 // Receives resources from the parent, moving them from mailboxes. Resource IDs
144 // passed are in the child namespace. 128 // passed are in the child namespace.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 scoped_ptr<TextureUploader> m_textureUploader; 260 scoped_ptr<TextureUploader> m_textureUploader;
277 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; 261 scoped_ptr<AcceleratedTextureCopier> m_textureCopier;
278 int m_maxTextureSize; 262 int m_maxTextureSize;
279 263
280 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 264 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
281 }; 265 };
282 266
283 } 267 }
284 268
285 #endif 269 #endif
OLDNEW
« cc/DEPS ('K') | « cc/cc.gyp ('k') | cc/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698