OLD | NEW |
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 | 5 |
6 #ifndef CCResourceProvider_h | 6 #ifndef CCResourceProvider_h |
7 #define CCResourceProvider_h | 7 #define CCResourceProvider_h |
8 | 8 |
9 #include "CCGraphicsContext.h" | 9 #include "CCGraphicsContext.h" |
10 #include "GraphicsContext3D.h" | 10 #include "GraphicsContext3D.h" |
11 #include "IntSize.h" | 11 #include "IntSize.h" |
12 #include "SkBitmap.h" | 12 #include "SkBitmap.h" |
13 #include "SkCanvas.h" | 13 #include "SkCanvas.h" |
14 #include "TextureCopier.h" | 14 #include "TextureCopier.h" |
15 #include <wtf/Deque.h> | 15 #include <wtf/Deque.h> |
16 #include <wtf/HashMap.h> | 16 #include <wtf/HashMap.h> |
17 #include <wtf/OwnPtr.h> | 17 #include <wtf/OwnPtr.h> |
18 #include <wtf/PassOwnPtr.h> | 18 #include <wtf/PassOwnPtr.h> |
19 #include <wtf/PassRefPtr.h> | 19 #include <wtf/PassRefPtr.h> |
20 #include <wtf/RefPtr.h> | 20 #include <wtf/RefPtr.h> |
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 enum TextureUploaderOption { ThrottledUploader, UnthrottledUploader }; | |
30 | |
31 class IntRect; | 29 class IntRect; |
32 class LayerTextureSubImage; | 30 class LayerTextureSubImage; |
33 class TextureCopier; | 31 class TextureCopier; |
34 class TextureUploader; | 32 class TextureUploader; |
35 | 33 |
36 // Thread-safety notes: this class is not thread-safe and can only be called | 34 // Thread-safety notes: this class is not thread-safe and can only be called |
37 // from the thread it was created on (in practice, the compositor thread). | 35 // from the thread it was created on (in practice, the compositor thread). |
38 class CCResourceProvider { | 36 class CCResourceProvider { |
39 WTF_MAKE_NONCOPYABLE(CCResourceProvider); | 37 WTF_MAKE_NONCOPYABLE(CCResourceProvider); |
40 public: | 38 public: |
(...skipping 13 matching lines...) Expand all Loading... |
54 GC3Denum format; | 52 GC3Denum format; |
55 IntSize size; | 53 IntSize size; |
56 Mailbox mailbox; | 54 Mailbox mailbox; |
57 }; | 55 }; |
58 typedef Vector<TransferableResource> TransferableResourceArray; | 56 typedef Vector<TransferableResource> TransferableResourceArray; |
59 struct TransferableResourceList { | 57 struct TransferableResourceList { |
60 TransferableResourceArray resources; | 58 TransferableResourceArray resources; |
61 unsigned syncPoint; | 59 unsigned syncPoint; |
62 }; | 60 }; |
63 | 61 |
64 static PassOwnPtr<CCResourceProvider> create(CCGraphicsContext*, TextureUplo
aderOption); | 62 static PassOwnPtr<CCResourceProvider> create(CCGraphicsContext*); |
65 | 63 |
66 virtual ~CCResourceProvider(); | 64 virtual ~CCResourceProvider(); |
67 | 65 |
68 WebKit::WebGraphicsContext3D* graphicsContext3D(); | 66 WebKit::WebGraphicsContext3D* graphicsContext3D(); |
69 TextureUploader* textureUploader() const { return m_textureUploader.get(); } | 67 TextureUploader* textureUploader() const { return m_textureUploader.get(); } |
70 TextureCopier* textureCopier() const { return m_textureCopier.get(); } | 68 TextureCopier* textureCopier() const { return m_textureCopier.get(); } |
71 int maxTextureSize() const { return m_maxTextureSize; } | 69 int maxTextureSize() const { return m_maxTextureSize; } |
72 unsigned numResources() const { return m_resources.size(); } | 70 unsigned numResources() const { return m_resources.size(); } |
73 | 71 |
74 // Checks whether a resource is in use by a consumer. | 72 // Checks whether a resource is in use by a consumer. |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 }; | 255 }; |
258 typedef HashMap<ResourceId, Resource> ResourceMap; | 256 typedef HashMap<ResourceId, Resource> ResourceMap; |
259 struct Child { | 257 struct Child { |
260 int pool; | 258 int pool; |
261 ResourceIdMap childToParentMap; | 259 ResourceIdMap childToParentMap; |
262 ResourceIdMap parentToChildMap; | 260 ResourceIdMap parentToChildMap; |
263 }; | 261 }; |
264 typedef HashMap<int, Child> ChildMap; | 262 typedef HashMap<int, Child> ChildMap; |
265 | 263 |
266 explicit CCResourceProvider(CCGraphicsContext*); | 264 explicit CCResourceProvider(CCGraphicsContext*); |
267 bool initialize(TextureUploaderOption); | 265 bool initialize(); |
268 | 266 |
269 const Resource* lockForRead(ResourceId); | 267 const Resource* lockForRead(ResourceId); |
270 void unlockForRead(ResourceId); | 268 void unlockForRead(ResourceId); |
271 const Resource* lockForWrite(ResourceId); | 269 const Resource* lockForWrite(ResourceId); |
272 void unlockForWrite(ResourceId); | 270 void unlockForWrite(ResourceId); |
273 static void populateSkBitmapWithResource(SkBitmap*, const Resource*); | 271 static void populateSkBitmapWithResource(SkBitmap*, const Resource*); |
274 | 272 |
275 bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, Transferabl
eResource*); | 273 bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, Transferabl
eResource*); |
276 void trimMailboxDeque(); | 274 void trimMailboxDeque(); |
277 | 275 |
(...skipping 11 matching lines...) Expand all Loading... |
289 bool m_useShallowFlush; | 287 bool m_useShallowFlush; |
290 OwnPtr<LayerTextureSubImage> m_texSubImage; | 288 OwnPtr<LayerTextureSubImage> m_texSubImage; |
291 OwnPtr<TextureUploader> m_textureUploader; | 289 OwnPtr<TextureUploader> m_textureUploader; |
292 OwnPtr<AcceleratedTextureCopier> m_textureCopier; | 290 OwnPtr<AcceleratedTextureCopier> m_textureCopier; |
293 int m_maxTextureSize; | 291 int m_maxTextureSize; |
294 }; | 292 }; |
295 | 293 |
296 } | 294 } |
297 | 295 |
298 #endif | 296 #endif |
OLD | NEW |