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