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 #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 "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
10 #include "GraphicsContext3D.h" | 11 #include "GraphicsContext3D.h" |
11 #include "IntSize.h" | 12 #include "IntSize.h" |
12 #include "SkBitmap.h" | 13 #include "SkBitmap.h" |
13 #include "SkCanvas.h" | 14 #include "SkCanvas.h" |
14 #include "TextureCopier.h" | 15 #include "TextureCopier.h" |
15 #include <wtf/Deque.h> | 16 #include <wtf/Deque.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 class IntRect; | 29 class IntRect; |
30 class LayerTextureSubImage; | 30 class LayerTextureSubImage; |
31 class TextureCopier; | 31 class TextureCopier; |
32 class TextureUploader; | 32 class TextureUploader; |
33 | 33 |
34 // 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 |
35 // 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). |
36 class CCResourceProvider { | 36 class CCResourceProvider { |
37 public: | 37 public: |
38 typedef unsigned ResourceId; | 38 typedef unsigned ResourceId; |
39 typedef Vector<ResourceId> ResourceIdArray; | 39 typedef Vector<ResourceId> ResourceIdArray; |
40 typedef HashMap<ResourceId, ResourceId> ResourceIdMap; | 40 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; |
41 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer }; | 41 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer }; |
42 enum ResourceType { | 42 enum ResourceType { |
43 GLTexture = 1, | 43 GLTexture = 1, |
44 Bitmap, | 44 Bitmap, |
45 }; | 45 }; |
46 struct Mailbox { | 46 struct Mailbox { |
47 GC3Dbyte name[64]; | 47 GC3Dbyte name[64]; |
48 }; | 48 }; |
49 struct TransferableResource { | 49 struct TransferableResource { |
50 unsigned id; | 50 unsigned id; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 int pool; | 221 int pool; |
222 int lockForReadCount; | 222 int lockForReadCount; |
223 bool lockedForWrite; | 223 bool lockedForWrite; |
224 bool external; | 224 bool external; |
225 bool exported; | 225 bool exported; |
226 bool markedForDeletion; | 226 bool markedForDeletion; |
227 IntSize size; | 227 IntSize size; |
228 GC3Denum format; | 228 GC3Denum format; |
229 ResourceType type; | 229 ResourceType type; |
230 }; | 230 }; |
231 typedef HashMap<ResourceId, Resource> ResourceMap; | 231 typedef base::hash_map<ResourceId, Resource> ResourceMap; |
232 struct Child { | 232 struct Child { |
233 Child(); | 233 Child(); |
234 ~Child(); | 234 ~Child(); |
235 | 235 |
236 int pool; | 236 int pool; |
237 ResourceIdMap childToParentMap; | 237 ResourceIdMap childToParentMap; |
238 ResourceIdMap parentToChildMap; | 238 ResourceIdMap parentToChildMap; |
239 }; | 239 }; |
240 typedef HashMap<int, Child> ChildMap; | 240 typedef base::hash_map<int, Child> ChildMap; |
241 | 241 |
242 explicit CCResourceProvider(CCGraphicsContext*); | 242 explicit CCResourceProvider(CCGraphicsContext*); |
243 bool initialize(); | 243 bool initialize(); |
244 | 244 |
245 const Resource* lockForRead(ResourceId); | 245 const Resource* lockForRead(ResourceId); |
246 void unlockForRead(ResourceId); | 246 void unlockForRead(ResourceId); |
247 const Resource* lockForWrite(ResourceId); | 247 const Resource* lockForWrite(ResourceId); |
248 void unlockForWrite(ResourceId); | 248 void unlockForWrite(ResourceId); |
249 static void populateSkBitmapWithResource(SkBitmap*, const Resource*); | 249 static void populateSkBitmapWithResource(SkBitmap*, const Resource*); |
250 | 250 |
(...skipping 17 matching lines...) Expand all Loading... |
268 OwnPtr<TextureUploader> m_textureUploader; | 268 OwnPtr<TextureUploader> m_textureUploader; |
269 OwnPtr<AcceleratedTextureCopier> m_textureCopier; | 269 OwnPtr<AcceleratedTextureCopier> m_textureCopier; |
270 int m_maxTextureSize; | 270 int m_maxTextureSize; |
271 | 271 |
272 DISALLOW_COPY_AND_ASSIGN(CCResourceProvider); | 272 DISALLOW_COPY_AND_ASSIGN(CCResourceProvider); |
273 }; | 273 }; |
274 | 274 |
275 } | 275 } |
276 | 276 |
277 #endif | 277 #endif |
OLD | NEW |