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 "base/hash_tables.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/threading/thread_checker.h" |
11 #include "cc/graphics_context.h" | 12 #include "cc/graphics_context.h" |
12 #include "cc/texture_copier.h" | 13 #include "cc/texture_copier.h" |
13 #include "third_party/khronos/GLES2/gl2.h" | 14 #include "third_party/khronos/GLES2/gl2.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 "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
17 #include <deque> | 18 #include <deque> |
18 #include <vector> | 19 #include <vector> |
19 | 20 |
20 namespace WebKit { | 21 namespace WebKit { |
21 class WebGraphicsContext3D; | 22 class WebGraphicsContext3D; |
22 } | 23 } |
23 | 24 |
24 namespace gfx { | 25 namespace gfx { |
25 class Rect; | 26 class Rect; |
26 class Vector2d; | 27 class Vector2d; |
27 } | 28 } |
28 | 29 |
29 namespace cc { | 30 namespace cc { |
30 | 31 |
31 class LayerTextureSubImage; | 32 class LayerTextureSubImage; |
32 class TextureCopier; | 33 class TextureCopier; |
33 class TextureUploader; | 34 class TextureUploader; |
34 | 35 |
35 // Thread-safety notes: this class is not thread-safe and can only be called | 36 // This class is not thread-safe and can only be called from the thread it was |
36 // from the thread it was created on (in practice, the compositor thread). | 37 // created on (in practice, the impl thread). |
37 class ResourceProvider { | 38 class ResourceProvider { |
38 public: | 39 public: |
39 typedef unsigned ResourceId; | 40 typedef unsigned ResourceId; |
40 typedef std::vector<ResourceId> ResourceIdArray; | 41 typedef std::vector<ResourceId> ResourceIdArray; |
41 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; | 42 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; |
42 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer }; | 43 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer }; |
43 enum ResourceType { | 44 enum ResourceType { |
44 GLTexture = 1, | 45 GLTexture = 1, |
45 Bitmap, | 46 Bitmap, |
46 }; | 47 }; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 std::deque<Mailbox> m_mailboxes; | 272 std::deque<Mailbox> m_mailboxes; |
272 | 273 |
273 ResourceType m_defaultResourceType; | 274 ResourceType m_defaultResourceType; |
274 bool m_useTextureStorageExt; | 275 bool m_useTextureStorageExt; |
275 bool m_useTextureUsageHint; | 276 bool m_useTextureUsageHint; |
276 bool m_useShallowFlush; | 277 bool m_useShallowFlush; |
277 scoped_ptr<TextureUploader> m_textureUploader; | 278 scoped_ptr<TextureUploader> m_textureUploader; |
278 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; | 279 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; |
279 int m_maxTextureSize; | 280 int m_maxTextureSize; |
280 | 281 |
| 282 base::ThreadChecker m_threadChecker; |
| 283 |
281 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 284 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
282 }; | 285 }; |
283 | 286 |
284 } | 287 } |
285 | 288 |
286 #endif | 289 #endif |
OLD | NEW |