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 CC_RESOURCE_PROVIDER_H_ | 5 #ifndef CC_RESOURCE_PROVIDER_H_ |
6 #define CC_RESOURCE_PROVIDER_H_ | 6 #define CC_RESOURCE_PROVIDER_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/cc_export.h" | 12 #include "cc/cc_export.h" |
12 #include "cc/graphics_context.h" | 13 #include "cc/graphics_context.h" |
13 #include "cc/texture_copier.h" | 14 #include "cc/texture_copier.h" |
14 #include "cc/transferable_resource.h" | 15 #include "cc/transferable_resource.h" |
15 #include "third_party/khronos/GLES2/gl2.h" | 16 #include "third_party/khronos/GLES2/gl2.h" |
16 #include "third_party/skia/include/core/SkBitmap.h" | 17 #include "third_party/skia/include/core/SkBitmap.h" |
17 #include "third_party/skia/include/core/SkCanvas.h" | 18 #include "third_party/skia/include/core/SkCanvas.h" |
18 #include "ui/gfx/size.h" | 19 #include "ui/gfx/size.h" |
19 #include <deque> | 20 #include <deque> |
20 #include <vector> | 21 #include <vector> |
21 | 22 |
22 namespace WebKit { | 23 namespace WebKit { |
23 class WebGraphicsContext3D; | 24 class WebGraphicsContext3D; |
24 } | 25 } |
25 | 26 |
26 namespace gfx { | 27 namespace gfx { |
27 class Rect; | 28 class Rect; |
28 class Vector2d; | 29 class Vector2d; |
29 } | 30 } |
30 | 31 |
31 namespace cc { | 32 namespace cc { |
32 | 33 |
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 CC_EXPORT ResourceProvider { | 38 class CC_EXPORT 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 std::deque<Mailbox> m_mailboxes; | 256 std::deque<Mailbox> m_mailboxes; |
256 | 257 |
257 ResourceType m_defaultResourceType; | 258 ResourceType m_defaultResourceType; |
258 bool m_useTextureStorageExt; | 259 bool m_useTextureStorageExt; |
259 bool m_useTextureUsageHint; | 260 bool m_useTextureUsageHint; |
260 bool m_useShallowFlush; | 261 bool m_useShallowFlush; |
261 scoped_ptr<TextureUploader> m_textureUploader; | 262 scoped_ptr<TextureUploader> m_textureUploader; |
262 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; | 263 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; |
263 int m_maxTextureSize; | 264 int m_maxTextureSize; |
264 | 265 |
| 266 base::ThreadChecker m_threadChecker; |
| 267 |
265 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 268 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
266 }; | 269 }; |
267 | 270 |
268 } | 271 } |
269 | 272 |
270 #endif // CC_RESOURCE_PROVIDER_H_ | 273 #endif // CC_RESOURCE_PROVIDER_H_ |
OLD | NEW |