| 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_RESOURCES_RESOURCE_PROVIDER_H_ | 5 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ | 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
| 18 #include "cc/base/cc_export.h" | 18 #include "cc/base/cc_export.h" |
| 19 #include "cc/output/context_provider.h" | 19 #include "cc/output/context_provider.h" |
| 20 #include "cc/output/output_surface.h" | 20 #include "cc/output/output_surface.h" |
| 21 #include "cc/resources/scoped_release_callback.h" |
| 21 #include "cc/resources/texture_mailbox.h" | 22 #include "cc/resources/texture_mailbox.h" |
| 22 #include "cc/resources/transferable_resource.h" | 23 #include "cc/resources/transferable_resource.h" |
| 23 #include "third_party/khronos/GLES2/gl2.h" | 24 #include "third_party/khronos/GLES2/gl2.h" |
| 24 #include "third_party/skia/include/core/SkBitmap.h" | 25 #include "third_party/skia/include/core/SkBitmap.h" |
| 25 #include "third_party/skia/include/core/SkCanvas.h" | 26 #include "third_party/skia/include/core/SkCanvas.h" |
| 26 #include "ui/gfx/size.h" | 27 #include "ui/gfx/size.h" |
| 27 | 28 |
| 28 namespace WebKit { class WebGraphicsContext3D; } | 29 namespace WebKit { class WebGraphicsContext3D; } |
| 29 | 30 |
| 30 namespace gfx { | 31 namespace gfx { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 GLint wrap_mode, | 97 GLint wrap_mode, |
| 97 TextureUsageHint hint); | 98 TextureUsageHint hint); |
| 98 | 99 |
| 99 ResourceId CreateBitmap(gfx::Size size); | 100 ResourceId CreateBitmap(gfx::Size size); |
| 100 // Wraps an external texture into a GL resource. | 101 // Wraps an external texture into a GL resource. |
| 101 ResourceId CreateResourceFromExternalTexture( | 102 ResourceId CreateResourceFromExternalTexture( |
| 102 unsigned texture_target, | 103 unsigned texture_target, |
| 103 unsigned texture_id); | 104 unsigned texture_id); |
| 104 | 105 |
| 105 // Wraps an external texture mailbox into a GL resource. | 106 // Wraps an external texture mailbox into a GL resource. |
| 106 ResourceId CreateResourceFromTextureMailbox(const TextureMailbox& mailbox); | 107 ResourceId CreateResourceFromTextureMailbox( |
| 108 const TextureMailbox& mailbox, |
| 109 ScopedReleaseCallback release_callback); |
| 107 | 110 |
| 108 void DeleteResource(ResourceId id); | 111 void DeleteResource(ResourceId id); |
| 109 | 112 |
| 110 // Update pixels from image, copying source_rect (in image) to dest_offset (in | 113 // Update pixels from image, copying source_rect (in image) to dest_offset (in |
| 111 // the resource). | 114 // the resource). |
| 112 void SetPixels(ResourceId id, | 115 void SetPixels(ResourceId id, |
| 113 const uint8_t* image, | 116 const uint8_t* image, |
| 114 gfx::Rect image_rect, | 117 gfx::Rect image_rect, |
| 115 gfx::Rect source_rect, | 118 gfx::Rect source_rect, |
| 116 gfx::Vector2d dest_offset); | 119 gfx::Vector2d dest_offset); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 GLenum format, | 350 GLenum format, |
| 348 GLenum filter, | 351 GLenum filter, |
| 349 GLint wrap_mode); | 352 GLint wrap_mode); |
| 350 | 353 |
| 351 unsigned gl_id; | 354 unsigned gl_id; |
| 352 // Pixel buffer used for set pixels without unnecessary copying. | 355 // Pixel buffer used for set pixels without unnecessary copying. |
| 353 unsigned gl_pixel_buffer_id; | 356 unsigned gl_pixel_buffer_id; |
| 354 // Query used to determine when asynchronous set pixels complete. | 357 // Query used to determine when asynchronous set pixels complete. |
| 355 unsigned gl_upload_query_id; | 358 unsigned gl_upload_query_id; |
| 356 TextureMailbox mailbox; | 359 TextureMailbox mailbox; |
| 360 ReleaseCallback release_callback; |
| 357 uint8_t* pixels; | 361 uint8_t* pixels; |
| 358 uint8_t* pixel_buffer; | 362 uint8_t* pixel_buffer; |
| 359 int lock_for_read_count; | 363 int lock_for_read_count; |
| 360 int imported_count; | 364 int imported_count; |
| 361 int exported_count; | 365 int exported_count; |
| 362 bool locked_for_write; | 366 bool locked_for_write; |
| 363 bool external; | 367 bool external; |
| 364 bool marked_for_deletion; | 368 bool marked_for_deletion; |
| 365 bool pending_set_pixels; | 369 bool pending_set_pixels; |
| 366 bool set_pixels_completion_forced; | 370 bool set_pixels_completion_forced; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 base::ThreadChecker thread_checker_; | 453 base::ThreadChecker thread_checker_; |
| 450 | 454 |
| 451 scoped_refptr<Fence> current_read_lock_fence_; | 455 scoped_refptr<Fence> current_read_lock_fence_; |
| 452 | 456 |
| 453 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 457 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 454 }; | 458 }; |
| 455 | 459 |
| 456 } // namespace cc | 460 } // namespace cc |
| 457 | 461 |
| 458 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 462 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |