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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/hash_tables.h" | 14 #include "base/hash_tables.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
17 #include "cc/cc_export.h" | 17 #include "cc/cc_export.h" |
| 18 #include "cc/grcontext_provider.h" |
18 #include "cc/output_surface.h" | 19 #include "cc/output_surface.h" |
19 #include "cc/texture_copier.h" | 20 #include "cc/texture_copier.h" |
20 #include "cc/texture_mailbox.h" | 21 #include "cc/texture_mailbox.h" |
21 #include "cc/transferable_resource.h" | 22 #include "cc/transferable_resource.h" |
22 #include "third_party/khronos/GLES2/gl2.h" | 23 #include "third_party/khronos/GLES2/gl2.h" |
23 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
24 #include "third_party/skia/include/core/SkCanvas.h" | 25 #include "third_party/skia/include/core/SkCanvas.h" |
25 #include "ui/gfx/size.h" | 26 #include "ui/gfx/size.h" |
26 | 27 |
27 namespace WebKit { | 28 namespace WebKit { |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // until this fence has passed. | 256 // until this fence has passed. |
256 void setReadLockFence(scoped_refptr<Fence> fence) { m_currentReadLockFence =
fence; } | 257 void setReadLockFence(scoped_refptr<Fence> fence) { m_currentReadLockFence =
fence; } |
257 Fence* getReadLockFence() { return m_currentReadLockFence; } | 258 Fence* getReadLockFence() { return m_currentReadLockFence; } |
258 | 259 |
259 // Enable read lock fences for a specific resource. | 260 // Enable read lock fences for a specific resource. |
260 void enableReadLockFences(ResourceProvider::ResourceId, bool enable); | 261 void enableReadLockFences(ResourceProvider::ResourceId, bool enable); |
261 | 262 |
262 // Indicates if we can currently lock this resource for write. | 263 // Indicates if we can currently lock this resource for write. |
263 bool canLockForWrite(ResourceId); | 264 bool canLockForWrite(ResourceId); |
264 | 265 |
| 266 GrContextProvider* offscreenContextProvider() { return &m_offscreenContextPr
ovider; } |
| 267 void setOffscreenContexts(WebKit::WebGraphicsContext3D* context3d, GrContext
* grContext) { m_offscreenContextProvider.set_contexts(context3d, grContext); } |
| 268 |
265 private: | 269 private: |
266 struct Resource { | 270 struct Resource { |
267 Resource(); | 271 Resource(); |
268 ~Resource(); | 272 ~Resource(); |
269 Resource(unsigned textureId, const gfx::Size& size, GLenum format, GLenu
m filter); | 273 Resource(unsigned textureId, const gfx::Size& size, GLenum format, GLenu
m filter); |
270 Resource(uint8_t* pixels, const gfx::Size& size, GLenum format, GLenum f
ilter); | 274 Resource(uint8_t* pixels, const gfx::Size& size, GLenum format, GLenum f
ilter); |
271 | 275 |
272 unsigned glId; | 276 unsigned glId; |
273 // Pixel buffer used for set pixels without unnecessary copying. | 277 // Pixel buffer used for set pixels without unnecessary copying. |
274 unsigned glPixelBufferId; | 278 unsigned glPixelBufferId; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 330 |
327 ResourceType m_defaultResourceType; | 331 ResourceType m_defaultResourceType; |
328 bool m_useTextureStorageExt; | 332 bool m_useTextureStorageExt; |
329 bool m_useTextureUsageHint; | 333 bool m_useTextureUsageHint; |
330 bool m_useShallowFlush; | 334 bool m_useShallowFlush; |
331 scoped_ptr<TextureUploader> m_textureUploader; | 335 scoped_ptr<TextureUploader> m_textureUploader; |
332 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; | 336 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; |
333 int m_maxTextureSize; | 337 int m_maxTextureSize; |
334 GLenum m_bestTextureFormat; | 338 GLenum m_bestTextureFormat; |
335 | 339 |
| 340 GrContextProvider m_offscreenContextProvider; |
| 341 |
336 base::ThreadChecker m_threadChecker; | 342 base::ThreadChecker m_threadChecker; |
337 | 343 |
338 scoped_refptr<Fence> m_currentReadLockFence; | 344 scoped_refptr<Fence> m_currentReadLockFence; |
339 | 345 |
340 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 346 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
341 }; | 347 }; |
342 | 348 |
343 } | 349 } |
344 | 350 |
345 #endif // CC_RESOURCE_PROVIDER_H_ | 351 #endif // CC_RESOURCE_PROVIDER_H_ |
OLD | NEW |