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 <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "cc/transferable_resource.h" | 21 #include "cc/transferable_resource.h" |
22 #include "third_party/khronos/GLES2/gl2.h" | 22 #include "third_party/khronos/GLES2/gl2.h" |
23 #include "third_party/skia/include/core/SkBitmap.h" | 23 #include "third_party/skia/include/core/SkBitmap.h" |
24 #include "third_party/skia/include/core/SkCanvas.h" | 24 #include "third_party/skia/include/core/SkCanvas.h" |
25 #include "ui/gfx/size.h" | 25 #include "ui/gfx/size.h" |
26 | 26 |
27 namespace WebKit { | 27 namespace WebKit { |
28 class WebGraphicsContext3D; | 28 class WebGraphicsContext3D; |
29 } | 29 } |
30 | 30 |
| 31 namespace ui { |
| 32 class ContextProvider; |
| 33 } |
| 34 |
31 namespace gfx { | 35 namespace gfx { |
32 class Rect; | 36 class Rect; |
33 class Vector2d; | 37 class Vector2d; |
34 } | 38 } |
35 | 39 |
36 namespace cc { | 40 namespace cc { |
37 | 41 |
38 class TextureUploader; | 42 class TextureUploader; |
39 | 43 |
40 // This class is not thread-safe and can only be called from the thread it was | 44 // This class is not thread-safe and can only be called from the thread it was |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 // until this fence has passed. | 260 // until this fence has passed. |
257 void setReadLockFence(scoped_refptr<Fence> fence) { m_currentReadLockFence =
fence; } | 261 void setReadLockFence(scoped_refptr<Fence> fence) { m_currentReadLockFence =
fence; } |
258 Fence* getReadLockFence() { return m_currentReadLockFence; } | 262 Fence* getReadLockFence() { return m_currentReadLockFence; } |
259 | 263 |
260 // Enable read lock fences for a specific resource. | 264 // Enable read lock fences for a specific resource. |
261 void enableReadLockFences(ResourceProvider::ResourceId, bool enable); | 265 void enableReadLockFences(ResourceProvider::ResourceId, bool enable); |
262 | 266 |
263 // Indicates if we can currently lock this resource for write. | 267 // Indicates if we can currently lock this resource for write. |
264 bool canLockForWrite(ResourceId); | 268 bool canLockForWrite(ResourceId); |
265 | 269 |
| 270 ui::ContextProvider* offscreenContextProvider() { return m_offscreenContextP
rovider.get(); } |
| 271 void setOffscreenContextProvider(scoped_refptr<ui::ContextProvider> offscree
nContextProvider); |
| 272 |
266 private: | 273 private: |
267 struct Resource { | 274 struct Resource { |
268 Resource(); | 275 Resource(); |
269 ~Resource(); | 276 ~Resource(); |
270 Resource(unsigned textureId, const gfx::Size& size, GLenum format, GLenu
m filter); | 277 Resource(unsigned textureId, const gfx::Size& size, GLenum format, GLenu
m filter); |
271 Resource(uint8_t* pixels, const gfx::Size& size, GLenum format, GLenum f
ilter); | 278 Resource(uint8_t* pixels, const gfx::Size& size, GLenum format, GLenum f
ilter); |
272 | 279 |
273 unsigned glId; | 280 unsigned glId; |
274 // Pixel buffer used for set pixels without unnecessary copying. | 281 // Pixel buffer used for set pixels without unnecessary copying. |
275 unsigned glPixelBufferId; | 282 unsigned glPixelBufferId; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 334 |
328 ResourceType m_defaultResourceType; | 335 ResourceType m_defaultResourceType; |
329 bool m_useTextureStorageExt; | 336 bool m_useTextureStorageExt; |
330 bool m_useTextureUsageHint; | 337 bool m_useTextureUsageHint; |
331 bool m_useShallowFlush; | 338 bool m_useShallowFlush; |
332 scoped_ptr<TextureUploader> m_textureUploader; | 339 scoped_ptr<TextureUploader> m_textureUploader; |
333 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; | 340 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; |
334 int m_maxTextureSize; | 341 int m_maxTextureSize; |
335 GLenum m_bestTextureFormat; | 342 GLenum m_bestTextureFormat; |
336 | 343 |
| 344 scoped_refptr<ui::ContextProvider> m_offscreenContextProvider; |
| 345 |
337 base::ThreadChecker m_threadChecker; | 346 base::ThreadChecker m_threadChecker; |
338 | 347 |
339 scoped_refptr<Fence> m_currentReadLockFence; | 348 scoped_refptr<Fence> m_currentReadLockFence; |
340 | 349 |
341 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 350 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
342 }; | 351 }; |
343 | 352 |
344 } | 353 } |
345 | 354 |
346 #endif // CC_RESOURCE_PROVIDER_H_ | 355 #endif // CC_RESOURCE_PROVIDER_H_ |
OLD | NEW |