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" | |
12 #include "cc/cc_export.h" | 11 #include "cc/cc_export.h" |
13 #include "cc/graphics_context.h" | 12 #include "cc/graphics_context.h" |
14 #include "cc/texture_copier.h" | 13 #include "cc/texture_copier.h" |
15 #include "cc/transferable_resource.h" | 14 #include "cc/transferable_resource.h" |
16 #include "third_party/khronos/GLES2/gl2.h" | 15 #include "third_party/khronos/GLES2/gl2.h" |
17 #include "third_party/skia/include/core/SkBitmap.h" | 16 #include "third_party/skia/include/core/SkBitmap.h" |
18 #include "third_party/skia/include/core/SkCanvas.h" | 17 #include "third_party/skia/include/core/SkCanvas.h" |
19 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
20 #include <deque> | 19 #include <deque> |
21 #include <vector> | 20 #include <vector> |
22 | 21 |
23 namespace WebKit { | 22 namespace WebKit { |
24 class WebGraphicsContext3D; | 23 class WebGraphicsContext3D; |
25 } | 24 } |
26 | 25 |
27 namespace gfx { | 26 namespace gfx { |
28 class Rect; | 27 class Rect; |
29 class Vector2d; | 28 class Vector2d; |
30 } | 29 } |
31 | 30 |
32 namespace cc { | 31 namespace cc { |
33 | 32 |
34 class TextureUploader; | 33 class TextureUploader; |
35 | 34 |
36 // This class is not thread-safe and can only be called from the thread it was | 35 // Thread-safety notes: this class is not thread-safe and can only be called |
37 // created on (in practice, the impl thread). | 36 // from the thread it was created on (in practice, the compositor thread). |
38 class CC_EXPORT ResourceProvider { | 37 class CC_EXPORT ResourceProvider { |
39 public: | 38 public: |
40 typedef unsigned ResourceId; | 39 typedef unsigned ResourceId; |
41 typedef std::vector<ResourceId> ResourceIdArray; | 40 typedef std::vector<ResourceId> ResourceIdArray; |
42 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; | 41 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; |
43 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer }; | 42 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer }; |
44 enum ResourceType { | 43 enum ResourceType { |
45 GLTexture = 1, | 44 GLTexture = 1, |
46 Bitmap, | 45 Bitmap, |
47 }; | 46 }; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 std::deque<Mailbox> m_mailboxes; | 255 std::deque<Mailbox> m_mailboxes; |
257 | 256 |
258 ResourceType m_defaultResourceType; | 257 ResourceType m_defaultResourceType; |
259 bool m_useTextureStorageExt; | 258 bool m_useTextureStorageExt; |
260 bool m_useTextureUsageHint; | 259 bool m_useTextureUsageHint; |
261 bool m_useShallowFlush; | 260 bool m_useShallowFlush; |
262 scoped_ptr<TextureUploader> m_textureUploader; | 261 scoped_ptr<TextureUploader> m_textureUploader; |
263 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; | 262 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; |
264 int m_maxTextureSize; | 263 int m_maxTextureSize; |
265 | 264 |
266 base::ThreadChecker m_threadChecker; | |
267 | |
268 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 265 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
269 }; | 266 }; |
270 | 267 |
271 } | 268 } |
272 | 269 |
273 #endif // CC_RESOURCE_PROVIDER_H_ | 270 #endif // CC_RESOURCE_PROVIDER_H_ |
OLD | NEW |