| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 ResourceType default_resource_type() const { return default_resource_type_; } | 117 ResourceType default_resource_type() const { return default_resource_type_; } |
| 118 ResourceType GetResourceType(ResourceId id); | 118 ResourceType GetResourceType(ResourceId id); |
| 119 | 119 |
| 120 // Creates a resource of the default resource type. | 120 // Creates a resource of the default resource type. |
| 121 ResourceId CreateResource(const gfx::Size& size, | 121 ResourceId CreateResource(const gfx::Size& size, |
| 122 TextureHint hint, | 122 TextureHint hint, |
| 123 ResourceFormat format); | 123 ResourceFormat format); |
| 124 | 124 |
| 125 // Creates a resource for a particular texture target (the distinction between | 125 // Creates a resource for a particular texture target (the distinction between |
| 126 // texture targets has no effect in software mode). | 126 // texture targets has no effect in software mode). |
| 127 ResourceId CreateManagedResource(const gfx::Size& size, | 127 ResourceId CreateResourceWithTextureTarget(const gfx::Size& size, |
| 128 GLenum target, | 128 GLenum target, |
| 129 TextureHint hint, | 129 TextureHint hint, |
| 130 ResourceFormat format); | 130 ResourceFormat format); |
| 131 | 131 |
| 132 // You can also explicitly create a specific resource type. | |
| 133 ResourceId CreateGLTexture(const gfx::Size& size, | |
| 134 GLenum target, | |
| 135 TextureHint hint, | |
| 136 ResourceFormat format); | |
| 137 | |
| 138 ResourceId CreateBitmap(const gfx::Size& size); | |
| 139 // Wraps an IOSurface into a GL resource. | 132 // Wraps an IOSurface into a GL resource. |
| 140 ResourceId CreateResourceFromIOSurface(const gfx::Size& size, | 133 ResourceId CreateResourceFromIOSurface(const gfx::Size& size, |
| 141 unsigned io_surface_id); | 134 unsigned io_surface_id); |
| 142 | 135 |
| 143 // Wraps an external texture mailbox into a GL resource. | 136 // Wraps an external texture mailbox into a GL resource. |
| 144 ResourceId CreateResourceFromTextureMailbox( | 137 ResourceId CreateResourceFromTextureMailbox( |
| 145 const TextureMailbox& mailbox, | 138 const TextureMailbox& mailbox, |
| 146 scoped_ptr<SingleReleaseCallbackImpl> release_callback_impl); | 139 scoped_ptr<SingleReleaseCallbackImpl> release_callback_impl); |
| 147 | 140 |
| 148 ResourceId CreateResourceFromTextureMailbox( | 141 ResourceId CreateResourceFromTextureMailbox( |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 bool marked_for_deletion; | 511 bool marked_for_deletion; |
| 519 bool needs_sync_points; | 512 bool needs_sync_points; |
| 520 }; | 513 }; |
| 521 typedef base::hash_map<int, Child> ChildMap; | 514 typedef base::hash_map<int, Child> ChildMap; |
| 522 | 515 |
| 523 bool ReadLockFenceHasPassed(const Resource* resource) { | 516 bool ReadLockFenceHasPassed(const Resource* resource) { |
| 524 return !resource->read_lock_fence.get() || | 517 return !resource->read_lock_fence.get() || |
| 525 resource->read_lock_fence->HasPassed(); | 518 resource->read_lock_fence->HasPassed(); |
| 526 } | 519 } |
| 527 | 520 |
| 521 ResourceId CreateGLTexture(const gfx::Size& size, |
| 522 GLenum target, |
| 523 TextureHint hint, |
| 524 ResourceFormat format); |
| 525 ResourceId CreateBitmap(const gfx::Size& size); |
| 528 Resource* InsertResource(ResourceId id, const Resource& resource); | 526 Resource* InsertResource(ResourceId id, const Resource& resource); |
| 529 Resource* GetResource(ResourceId id); | 527 Resource* GetResource(ResourceId id); |
| 530 const Resource* LockForRead(ResourceId id); | 528 const Resource* LockForRead(ResourceId id); |
| 531 void UnlockForRead(ResourceId id); | 529 void UnlockForRead(ResourceId id); |
| 532 Resource* LockForWrite(ResourceId id); | 530 Resource* LockForWrite(ResourceId id); |
| 533 void UnlockForWrite(Resource* resource); | 531 void UnlockForWrite(Resource* resource); |
| 534 | 532 |
| 535 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, | 533 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, |
| 536 const Resource* resource); | 534 const Resource* resource); |
| 537 | 535 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 // A process-unique ID used for disambiguating memory dumps from different | 593 // A process-unique ID used for disambiguating memory dumps from different |
| 596 // resource providers. | 594 // resource providers. |
| 597 int tracing_id_; | 595 int tracing_id_; |
| 598 | 596 |
| 599 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 597 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 600 }; | 598 }; |
| 601 | 599 |
| 602 } // namespace cc | 600 } // namespace cc |
| 603 | 601 |
| 604 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 602 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |