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

Side by Side Diff: cc/resource_provider.h

Issue 11183006: cc: Remove wtf includes from resource provider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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/prioritized_texture_unittest.cc ('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"
9 #include "base/hash_tables.h"
10 #include "base/memory/scoped_ptr.h"
8 #include "CCGraphicsContext.h" 11 #include "CCGraphicsContext.h"
12 #include "cc/texture_copier.h"
9 #include "GraphicsContext3D.h" 13 #include "GraphicsContext3D.h"
10 #include "IntSize.h" 14 #include "IntSize.h"
11 #include "base/basictypes.h"
12 #include "base/hash_tables.h"
13 #include "cc/texture_copier.h"
14 #include "third_party/skia/include/core/SkBitmap.h" 15 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "third_party/skia/include/core/SkCanvas.h" 16 #include "third_party/skia/include/core/SkCanvas.h"
16 #include <wtf/Deque.h> 17 #include <deque>
17 #include <wtf/OwnPtr.h> 18 #include <vector>
18 #include <wtf/PassOwnPtr.h>
19 #include <wtf/PassRefPtr.h>
20 #include <wtf/RefPtr.h>
21 #include <wtf/Vector.h>
22 19
23 namespace WebKit { 20 namespace WebKit {
24 class WebGraphicsContext3D; 21 class WebGraphicsContext3D;
25 } 22 }
26 23
27 namespace cc { 24 namespace cc {
28 25
29 class IntRect; 26 class IntRect;
30 class LayerTextureSubImage; 27 class LayerTextureSubImage;
31 class TextureCopier; 28 class TextureCopier;
32 class TextureUploader; 29 class TextureUploader;
33 30
34 // Thread-safety notes: this class is not thread-safe and can only be called 31 // 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). 32 // from the thread it was created on (in practice, the compositor thread).
36 class CCResourceProvider { 33 class CCResourceProvider {
37 public: 34 public:
38 typedef unsigned ResourceId; 35 typedef unsigned ResourceId;
39 typedef Vector<ResourceId> ResourceIdArray; 36 typedef std::vector<ResourceId> ResourceIdArray;
40 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; 37 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap;
41 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer }; 38 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer };
42 enum ResourceType { 39 enum ResourceType {
43 GLTexture = 1, 40 GLTexture = 1,
44 Bitmap, 41 Bitmap,
45 }; 42 };
46 struct Mailbox { 43 struct Mailbox {
47 GC3Dbyte name[64]; 44 GC3Dbyte name[64];
48 }; 45 };
49 struct TransferableResource { 46 struct TransferableResource {
50 unsigned id; 47 unsigned id;
51 GC3Denum format; 48 GC3Denum format;
52 IntSize size; 49 IntSize size;
53 Mailbox mailbox; 50 Mailbox mailbox;
54 }; 51 };
55 typedef Vector<TransferableResource> TransferableResourceArray; 52 typedef std::vector<TransferableResource> TransferableResourceArray;
56 struct TransferableResourceList { 53 struct TransferableResourceList {
57 TransferableResourceList(); 54 TransferableResourceList();
58 ~TransferableResourceList(); 55 ~TransferableResourceList();
59 56
60 TransferableResourceArray resources; 57 TransferableResourceArray resources;
61 unsigned syncPoint; 58 unsigned syncPoint;
62 }; 59 };
63 60
64 static PassOwnPtr<CCResourceProvider> create(CCGraphicsContext*); 61 static scoped_ptr<CCResourceProvider> create(CCGraphicsContext*);
65 62
66 virtual ~CCResourceProvider(); 63 virtual ~CCResourceProvider();
67 64
68 WebKit::WebGraphicsContext3D* graphicsContext3D(); 65 WebKit::WebGraphicsContext3D* graphicsContext3D();
69 TextureUploader* textureUploader() const { return m_textureUploader.get(); } 66 TextureUploader* textureUploader() const { return m_textureUploader.get(); }
70 TextureCopier* textureCopier() const { return m_textureCopier.get(); } 67 TextureCopier* textureCopier() const { return m_textureCopier.get(); }
71 int maxTextureSize() const { return m_maxTextureSize; } 68 int maxTextureSize() const { return m_maxTextureSize; }
72 unsigned numResources() const { return m_resources.size(); } 69 unsigned numResources() const { return m_resources.size(); }
73 70
74 // Checks whether a resource is in use by a consumer. 71 // Checks whether a resource is in use by a consumer.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 public: 195 public:
199 ScopedWriteLockSoftware(CCResourceProvider*, CCResourceProvider::Resourc eId); 196 ScopedWriteLockSoftware(CCResourceProvider*, CCResourceProvider::Resourc eId);
200 ~ScopedWriteLockSoftware(); 197 ~ScopedWriteLockSoftware();
201 198
202 SkCanvas* skCanvas() { return m_skCanvas.get(); } 199 SkCanvas* skCanvas() { return m_skCanvas.get(); }
203 200
204 private: 201 private:
205 CCResourceProvider* m_resourceProvider; 202 CCResourceProvider* m_resourceProvider;
206 CCResourceProvider::ResourceId m_resourceId; 203 CCResourceProvider::ResourceId m_resourceId;
207 SkBitmap m_skBitmap; 204 SkBitmap m_skBitmap;
208 OwnPtr<SkCanvas> m_skCanvas; 205 scoped_ptr<SkCanvas> m_skCanvas;
209 206
210 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); 207 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware);
211 }; 208 };
212 209
213 private: 210 private:
214 struct Resource { 211 struct Resource {
215 Resource(); 212 Resource();
216 Resource(unsigned textureId, int pool, const IntSize& size, GC3Denum for mat); 213 Resource(unsigned textureId, int pool, const IntSize& size, GC3Denum for mat);
217 Resource(uint8_t* pixels, int pool, const IntSize& size, GC3Denum format ); 214 Resource(uint8_t* pixels, int pool, const IntSize& size, GC3Denum format );
218 215
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, Transferabl eResource*); 248 bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, Transferabl eResource*);
252 void trimMailboxDeque(); 249 void trimMailboxDeque();
253 void deleteResourceInternal(ResourceMap::iterator it); 250 void deleteResourceInternal(ResourceMap::iterator it);
254 251
255 CCGraphicsContext* m_context; 252 CCGraphicsContext* m_context;
256 ResourceId m_nextId; 253 ResourceId m_nextId;
257 ResourceMap m_resources; 254 ResourceMap m_resources;
258 int m_nextChild; 255 int m_nextChild;
259 ChildMap m_children; 256 ChildMap m_children;
260 257
261 Deque<Mailbox> m_mailboxes; 258 std::deque<Mailbox> m_mailboxes;
262 259
263 ResourceType m_defaultResourceType; 260 ResourceType m_defaultResourceType;
264 bool m_useTextureStorageExt; 261 bool m_useTextureStorageExt;
265 bool m_useTextureUsageHint; 262 bool m_useTextureUsageHint;
266 bool m_useShallowFlush; 263 bool m_useShallowFlush;
267 OwnPtr<LayerTextureSubImage> m_texSubImage; 264 scoped_ptr<LayerTextureSubImage> m_texSubImage;
268 OwnPtr<TextureUploader> m_textureUploader; 265 scoped_ptr<TextureUploader> m_textureUploader;
269 OwnPtr<AcceleratedTextureCopier> m_textureCopier; 266 scoped_ptr<AcceleratedTextureCopier> m_textureCopier;
270 int m_maxTextureSize; 267 int m_maxTextureSize;
271 268
272 DISALLOW_COPY_AND_ASSIGN(CCResourceProvider); 269 DISALLOW_COPY_AND_ASSIGN(CCResourceProvider);
273 }; 270 };
274 271
275 } 272 }
276 273
277 #endif 274 #endif
OLDNEW
« no previous file with comments | « cc/prioritized_texture_unittest.cc ('k') | cc/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698