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> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "cc/resources/return_callback.h" | 26 #include "cc/resources/return_callback.h" |
27 #include "cc/resources/shared_bitmap.h" | 27 #include "cc/resources/shared_bitmap.h" |
28 #include "cc/resources/single_release_callback_impl.h" | 28 #include "cc/resources/single_release_callback_impl.h" |
29 #include "cc/resources/texture_mailbox.h" | 29 #include "cc/resources/texture_mailbox.h" |
30 #include "cc/resources/transferable_resource.h" | 30 #include "cc/resources/transferable_resource.h" |
31 #include "third_party/khronos/GLES2/gl2.h" | 31 #include "third_party/khronos/GLES2/gl2.h" |
32 #include "third_party/khronos/GLES2/gl2ext.h" | 32 #include "third_party/khronos/GLES2/gl2ext.h" |
33 #include "third_party/skia/include/core/SkBitmap.h" | 33 #include "third_party/skia/include/core/SkBitmap.h" |
34 #include "third_party/skia/include/core/SkCanvas.h" | 34 #include "third_party/skia/include/core/SkCanvas.h" |
35 #include "ui/gfx/geometry/size.h" | 35 #include "ui/gfx/geometry/size.h" |
| 36 #include "ui/gfx/gpu_memory_buffer.h" |
36 | 37 |
37 class GrContext; | 38 class GrContext; |
38 | 39 |
39 namespace gpu { | 40 namespace gpu { |
40 class GpuMemoryBufferManager; | 41 class GpuMemoryBufferManager; |
41 namespace gles { | 42 namespace gles { |
42 class GLES2Interface; | 43 class GLES2Interface; |
43 } | 44 } |
44 } | 45 } |
45 | 46 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 ResourceProvider::Resource* resource_; | 325 ResourceProvider::Resource* resource_; |
325 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 326 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
326 gfx::GpuMemoryBuffer* gpu_memory_buffer_; | 327 gfx::GpuMemoryBuffer* gpu_memory_buffer_; |
327 gfx::Size size_; | 328 gfx::Size size_; |
328 ResourceFormat format_; | 329 ResourceFormat format_; |
329 base::ThreadChecker thread_checker_; | 330 base::ThreadChecker thread_checker_; |
330 | 331 |
331 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); | 332 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); |
332 }; | 333 }; |
333 | 334 |
| 335 class CC_EXPORT ScopedWriteLockGpuMemoryBufferForThread { |
| 336 public: |
| 337 ScopedWriteLockGpuMemoryBufferForThread(ResourceProvider* resource_provider, |
| 338 ResourceId resource_id); |
| 339 ~ScopedWriteLockGpuMemoryBufferForThread(); |
| 340 |
| 341 gfx::GpuMemoryBuffer* GetGpuMemoryBuffer(); |
| 342 void CreateAndBindImage(); |
| 343 ContextProvider* worker_context() { return worker_context_; } |
| 344 void BeginCopyTexture(); |
| 345 void EndCopyTexture(); |
| 346 ResourceFormat format() { return format_; } |
| 347 gfx::Size size() { return size_; } |
| 348 unsigned source_gl_id() { return source_gl_id_; } |
| 349 |
| 350 private: |
| 351 ResourceProvider* resource_provider_; |
| 352 ResourceProvider::Resource* resource_; |
| 353 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
| 354 gfx::GpuMemoryBuffer* gpu_memory_buffer_; |
| 355 base::ThreadChecker thread_checker_; |
| 356 ContextProvider* worker_context_; |
| 357 unsigned image_id_; |
| 358 unsigned bound_image_id_; |
| 359 unsigned source_gl_id_; |
| 360 gfx::Size size_; |
| 361 ResourceFormat format_; |
| 362 GLenum internal_format_; |
| 363 bool did_bind_image_; |
| 364 unsigned query_id_; |
| 365 bool using_sync_query_; |
| 366 gfx::GpuMemoryBuffer::Usage usage_; |
| 367 |
| 368 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBufferForThread); |
| 369 }; |
| 370 |
334 class CC_EXPORT ScopedWriteLockGr { | 371 class CC_EXPORT ScopedWriteLockGr { |
335 public: | 372 public: |
336 ScopedWriteLockGr(ResourceProvider* resource_provider, | 373 ScopedWriteLockGr(ResourceProvider* resource_provider, |
337 ResourceId resource_id); | 374 ResourceId resource_id); |
338 ~ScopedWriteLockGr(); | 375 ~ScopedWriteLockGr(); |
339 | 376 |
340 void InitSkSurface(bool use_distance_field_text, | 377 void InitSkSurface(bool use_distance_field_text, |
341 bool can_use_lcd_text, | 378 bool can_use_lcd_text, |
342 int msaa_sample_count); | 379 int msaa_sample_count); |
343 void ReleaseSkSurface(); | 380 void ReleaseSkSurface(); |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 return format_gl_data_format[format]; | 695 return format_gl_data_format[format]; |
659 } | 696 } |
660 | 697 |
661 inline GLenum GLInternalFormat(ResourceFormat format) { | 698 inline GLenum GLInternalFormat(ResourceFormat format) { |
662 return GLDataFormat(format); | 699 return GLDataFormat(format); |
663 } | 700 } |
664 | 701 |
665 } // namespace cc | 702 } // namespace cc |
666 | 703 |
667 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 704 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |