| 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 13 matching lines...) Expand all Loading... |
| 24 #include "cc/resources/return_callback.h" | 24 #include "cc/resources/return_callback.h" |
| 25 #include "cc/resources/single_release_callback.h" | 25 #include "cc/resources/single_release_callback.h" |
| 26 #include "cc/resources/texture_mailbox.h" | 26 #include "cc/resources/texture_mailbox.h" |
| 27 #include "cc/resources/transferable_resource.h" | 27 #include "cc/resources/transferable_resource.h" |
| 28 #include "third_party/khronos/GLES2/gl2.h" | 28 #include "third_party/khronos/GLES2/gl2.h" |
| 29 #include "third_party/khronos/GLES2/gl2ext.h" | 29 #include "third_party/khronos/GLES2/gl2ext.h" |
| 30 #include "third_party/skia/include/core/SkBitmap.h" | 30 #include "third_party/skia/include/core/SkBitmap.h" |
| 31 #include "third_party/skia/include/core/SkCanvas.h" | 31 #include "third_party/skia/include/core/SkCanvas.h" |
| 32 #include "ui/gfx/size.h" | 32 #include "ui/gfx/size.h" |
| 33 | 33 |
| 34 namespace WebKit { class WebGraphicsContext3D; } | 34 namespace blink { class WebGraphicsContext3D; } |
| 35 | 35 |
| 36 namespace gfx { | 36 namespace gfx { |
| 37 class Rect; | 37 class Rect; |
| 38 class Vector2d; | 38 class Vector2d; |
| 39 } | 39 } |
| 40 | 40 |
| 41 namespace cc { | 41 namespace cc { |
| 42 class IdAllocator; | 42 class IdAllocator; |
| 43 class SharedBitmap; | 43 class SharedBitmap; |
| 44 class SharedBitmapManager; | 44 class SharedBitmapManager; |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 current_read_lock_fence_ = fence; | 345 current_read_lock_fence_ = fence; |
| 346 } | 346 } |
| 347 Fence* GetReadLockFence() { return current_read_lock_fence_.get(); } | 347 Fence* GetReadLockFence() { return current_read_lock_fence_.get(); } |
| 348 | 348 |
| 349 // Enable read lock fences for a specific resource. | 349 // Enable read lock fences for a specific resource. |
| 350 void EnableReadLockFences(ResourceProvider::ResourceId id, bool enable); | 350 void EnableReadLockFences(ResourceProvider::ResourceId id, bool enable); |
| 351 | 351 |
| 352 // Indicates if we can currently lock this resource for write. | 352 // Indicates if we can currently lock this resource for write. |
| 353 bool CanLockForWrite(ResourceId id); | 353 bool CanLockForWrite(ResourceId id); |
| 354 | 354 |
| 355 static GLint GetActiveTextureUnit(WebKit::WebGraphicsContext3D* context); | 355 static GLint GetActiveTextureUnit(blink::WebGraphicsContext3D* context); |
| 356 | 356 |
| 357 private: | 357 private: |
| 358 struct Resource { | 358 struct Resource { |
| 359 Resource(); | 359 Resource(); |
| 360 ~Resource(); | 360 ~Resource(); |
| 361 Resource(unsigned texture_id, | 361 Resource(unsigned texture_id, |
| 362 gfx::Size size, | 362 gfx::Size size, |
| 363 GLenum target, | 363 GLenum target, |
| 364 GLenum filter, | 364 GLenum filter, |
| 365 GLenum texture_pool, | 365 GLenum texture_pool, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 void CleanUpGLIfNeeded(); | 440 void CleanUpGLIfNeeded(); |
| 441 | 441 |
| 442 Resource* GetResource(ResourceId id); | 442 Resource* GetResource(ResourceId id); |
| 443 const Resource* LockForRead(ResourceId id); | 443 const Resource* LockForRead(ResourceId id); |
| 444 void UnlockForRead(ResourceId id); | 444 void UnlockForRead(ResourceId id); |
| 445 const Resource* LockForWrite(ResourceId id); | 445 const Resource* LockForWrite(ResourceId id); |
| 446 void UnlockForWrite(ResourceId id); | 446 void UnlockForWrite(ResourceId id); |
| 447 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, | 447 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, |
| 448 const Resource* resource); | 448 const Resource* resource); |
| 449 | 449 |
| 450 void TransferResource(WebKit::WebGraphicsContext3D* context, | 450 void TransferResource(blink::WebGraphicsContext3D* context, |
| 451 ResourceId id, | 451 ResourceId id, |
| 452 TransferableResource* resource); | 452 TransferableResource* resource); |
| 453 enum DeleteStyle { | 453 enum DeleteStyle { |
| 454 Normal, | 454 Normal, |
| 455 ForShutdown, | 455 ForShutdown, |
| 456 }; | 456 }; |
| 457 void DeleteResourceInternal(ResourceMap::iterator it, DeleteStyle style); | 457 void DeleteResourceInternal(ResourceMap::iterator it, DeleteStyle style); |
| 458 void DeleteAndReturnUnusedResourcesToChild(Child* child_info, | 458 void DeleteAndReturnUnusedResourcesToChild(Child* child_info, |
| 459 DeleteStyle style, | 459 DeleteStyle style, |
| 460 const ResourceIdArray& unused); | 460 const ResourceIdArray& unused); |
| 461 void LazyCreate(Resource* resource); | 461 void LazyCreate(Resource* resource); |
| 462 void LazyAllocate(Resource* resource); | 462 void LazyAllocate(Resource* resource); |
| 463 | 463 |
| 464 // Binds the given GL resource to a texture target for sampling using the | 464 // Binds the given GL resource to a texture target for sampling using the |
| 465 // specified filter for both minification and magnification. The resource | 465 // specified filter for both minification and magnification. The resource |
| 466 // must be locked for reading. | 466 // must be locked for reading. |
| 467 void BindForSampling(ResourceProvider::ResourceId resource_id, | 467 void BindForSampling(ResourceProvider::ResourceId resource_id, |
| 468 GLenum target, | 468 GLenum target, |
| 469 GLenum unit, | 469 GLenum unit, |
| 470 GLenum filter); | 470 GLenum filter); |
| 471 | 471 |
| 472 // Returns NULL if the output_surface_ does not have a ContextProvider. | 472 // Returns NULL if the output_surface_ does not have a ContextProvider. |
| 473 WebKit::WebGraphicsContext3D* Context3d() const; | 473 blink::WebGraphicsContext3D* Context3d() const; |
| 474 | 474 |
| 475 OutputSurface* output_surface_; | 475 OutputSurface* output_surface_; |
| 476 SharedBitmapManager* shared_bitmap_manager_; | 476 SharedBitmapManager* shared_bitmap_manager_; |
| 477 bool lost_output_surface_; | 477 bool lost_output_surface_; |
| 478 int highp_threshold_min_; | 478 int highp_threshold_min_; |
| 479 ResourceId next_id_; | 479 ResourceId next_id_; |
| 480 ResourceMap resources_; | 480 ResourceMap resources_; |
| 481 int next_child_; | 481 int next_child_; |
| 482 ChildMap children_; | 482 ChildMap children_; |
| 483 | 483 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 return format_gl_data_format[format]; | 544 return format_gl_data_format[format]; |
| 545 } | 545 } |
| 546 | 546 |
| 547 inline GLenum GLInternalFormat(ResourceFormat format) { | 547 inline GLenum GLInternalFormat(ResourceFormat format) { |
| 548 return GLDataFormat(format); | 548 return GLDataFormat(format); |
| 549 } | 549 } |
| 550 | 550 |
| 551 } // namespace cc | 551 } // namespace cc |
| 552 | 552 |
| 553 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 553 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |