| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 bool IsLost(ResourceId id); | 124 bool IsLost(ResourceId id); |
| 125 | 125 |
| 126 void LoseResourceForTesting(ResourceId id); | 126 void LoseResourceForTesting(ResourceId id); |
| 127 void EnableReadLockFencesForTesting(ResourceId id); | 127 void EnableReadLockFencesForTesting(ResourceId id); |
| 128 | 128 |
| 129 // Producer interface. | 129 // Producer interface. |
| 130 | 130 |
| 131 ResourceType default_resource_type() const { return default_resource_type_; } | 131 ResourceType default_resource_type() const { return default_resource_type_; } |
| 132 ResourceType GetResourceType(ResourceId id); | 132 ResourceType GetResourceType(ResourceId id); |
| 133 GLenum GetResourceTextureTarget(ResourceId id); | 133 GLenum GetResourceTextureTarget(ResourceId id); |
| 134 ResourceFormat GetResourceFormat(ResourceId id); |
| 134 bool IsImmutable(ResourceId id); | 135 bool IsImmutable(ResourceId id); |
| 135 TextureHint GetTextureHint(ResourceId id); | 136 TextureHint GetTextureHint(ResourceId id); |
| 136 | 137 |
| 137 // Creates a resource of the default resource type. | 138 // Creates a resource of the default resource type. |
| 138 ResourceId CreateResource(const gfx::Size& size, | 139 ResourceId CreateResource(const gfx::Size& size, |
| 139 TextureHint hint, | 140 TextureHint hint, |
| 140 ResourceFormat format, | 141 ResourceFormat format, |
| 141 const gfx::ColorSpace& color_space); | 142 const gfx::ColorSpace& color_space); |
| 142 | 143 |
| 143 // Creates a resource for a particular texture target (the distinction between | 144 // Creates a resource for a particular texture target (the distinction between |
| 144 // texture targets has no effect in software mode). | 145 // texture targets has no effect in software mode). |
| 145 ResourceId CreateGpuMemoryBufferResource(const gfx::Size& size, | 146 ResourceId CreateGpuMemoryBufferResource(const gfx::Size& size, |
| 146 TextureHint hint, | 147 TextureHint hint, |
| 147 ResourceFormat format, | 148 ResourceFormat format, |
| 148 gfx::BufferUsage usage, | 149 gfx::BufferUsage usage, |
| 149 const gfx::ColorSpace& color_space); | 150 const gfx::ColorSpace& color_space); |
| 150 | 151 |
| 151 // Wraps an external texture mailbox into a GL resource. | 152 // Wraps an external texture mailbox into a GL resource. |
| 152 ResourceId CreateResourceFromTextureMailbox( | 153 ResourceId CreateResourceFromTextureMailbox( |
| 153 const TextureMailbox& mailbox, | 154 const TextureMailbox& mailbox, |
| 154 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl); | 155 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl); |
| 155 | 156 |
| 156 ResourceId CreateResourceFromTextureMailbox( | 157 ResourceId CreateResourceFromTextureMailbox( |
| 157 const TextureMailbox& mailbox, | 158 const TextureMailbox& mailbox, |
| 158 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl, | 159 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl, |
| 159 bool read_lock_fences_enabled); | 160 bool read_lock_fences_enabled); |
| 160 | 161 |
| 162 ResourceId CreateResourceFromTextureMailbox( |
| 163 const TextureMailbox& mailbox, |
| 164 ResourceFormat format, |
| 165 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl, |
| 166 bool read_lock_fences_enabled); |
| 167 |
| 161 void DeleteResource(ResourceId id); | 168 void DeleteResource(ResourceId id); |
| 162 | 169 |
| 163 // Update pixels from image, copying source_rect (in image) to dest_offset (in | 170 // Update pixels from image, copying source_rect (in image) to dest_offset (in |
| 164 // the resource). | 171 // the resource). |
| 165 void CopyToResource(ResourceId id, | 172 void CopyToResource(ResourceId id, |
| 166 const uint8_t* image, | 173 const uint8_t* image, |
| 167 const gfx::Size& image_size); | 174 const gfx::Size& image_size); |
| 168 | 175 |
| 169 // Generates sync tokesn for resources which need a sync token. | 176 // Generates sync tokesn for resources which need a sync token. |
| 170 void GenerateSyncTokenForResource(ResourceId resource_id); | 177 void GenerateSyncTokenForResource(ResourceId resource_id); |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 // A process-unique ID used for disambiguating memory dumps from different | 723 // A process-unique ID used for disambiguating memory dumps from different |
| 717 // resource providers. | 724 // resource providers. |
| 718 int tracing_id_; | 725 int tracing_id_; |
| 719 | 726 |
| 720 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 727 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 721 }; | 728 }; |
| 722 | 729 |
| 723 } // namespace cc | 730 } // namespace cc |
| 724 | 731 |
| 725 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 732 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |