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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 class GpuMemoryBuffer; | 47 class GpuMemoryBuffer; |
48 class Rect; | 48 class Rect; |
49 class Vector2d; | 49 class Vector2d; |
50 } | 50 } |
51 | 51 |
52 namespace cc { | 52 namespace cc { |
53 class BlockingTaskRunner; | 53 class BlockingTaskRunner; |
54 class IdAllocator; | 54 class IdAllocator; |
55 class SharedBitmap; | 55 class SharedBitmap; |
56 class SharedBitmapManager; | 56 class SharedBitmapManager; |
57 class TextureUploader; | |
58 | 57 |
59 // This class is not thread-safe and can only be called from the thread it was | 58 // This class is not thread-safe and can only be called from the thread it was |
60 // created on (in practice, the impl thread). | 59 // created on (in practice, the impl thread). |
61 class CC_EXPORT ResourceProvider { | 60 class CC_EXPORT ResourceProvider { |
62 private: | 61 private: |
63 struct Resource; | 62 struct Resource; |
64 | 63 |
65 public: | 64 public: |
66 typedef std::vector<ResourceId> ResourceIdArray; | 65 typedef std::vector<ResourceId> ResourceIdArray; |
67 typedef base::hash_set<ResourceId> ResourceIdSet; | 66 typedef base::hash_set<ResourceId> ResourceIdSet; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 148 |
150 ResourceId CreateResourceFromTextureMailbox( | 149 ResourceId CreateResourceFromTextureMailbox( |
151 const TextureMailbox& mailbox, | 150 const TextureMailbox& mailbox, |
152 scoped_ptr<SingleReleaseCallbackImpl> release_callback_impl, | 151 scoped_ptr<SingleReleaseCallbackImpl> release_callback_impl, |
153 bool read_lock_fences_enabled); | 152 bool read_lock_fences_enabled); |
154 | 153 |
155 void DeleteResource(ResourceId id); | 154 void DeleteResource(ResourceId id); |
156 | 155 |
157 // Update pixels from image, copying source_rect (in image) to dest_offset (in | 156 // Update pixels from image, copying source_rect (in image) to dest_offset (in |
158 // the resource). | 157 // the resource). |
159 // NOTE: DEPRECATED. Use CopyToResource() instead. | |
160 void SetPixels(ResourceId id, | |
161 const uint8_t* image, | |
162 const gfx::Rect& image_rect, | |
163 const gfx::Rect& source_rect, | |
164 const gfx::Vector2d& dest_offset); | |
165 void CopyToResource(ResourceId id, | 158 void CopyToResource(ResourceId id, |
166 const uint8_t* image, | 159 const uint8_t* image, |
167 const gfx::Size& image_size); | 160 const gfx::Size& image_size); |
168 | 161 |
169 // Check upload status. | |
170 size_t NumBlockingUploads(); | |
171 void MarkPendingUploadsAsNonBlocking(); | |
172 size_t EstimatedUploadsPerTick(); | |
173 void FlushUploads(); | |
174 void ReleaseCachedData(); | |
175 base::TimeTicks EstimatedUploadCompletionTime(size_t uploads_per_tick); | |
176 | |
177 // Only flush the command buffer if supported. | 162 // Only flush the command buffer if supported. |
178 // Returns true if the shallow flush occurred, false otherwise. | 163 // Returns true if the shallow flush occurred, false otherwise. |
179 bool ShallowFlushIfSupported(); | 164 bool ShallowFlushIfSupported(); |
180 | 165 |
181 // Creates accounting for a child. Returns a child ID. | 166 // Creates accounting for a child. Returns a child ID. |
182 int CreateChild(const ReturnCallback& return_callback); | 167 int CreateChild(const ReturnCallback& return_callback); |
183 | 168 |
184 // Destroys accounting for the child, deleting all accounted resources. | 169 // Destroys accounting for the child, deleting all accounted resources. |
185 void DestroyChild(int child); | 170 void DestroyChild(int child); |
186 | 171 |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 ResourceMap resources_; | 576 ResourceMap resources_; |
592 int next_child_; | 577 int next_child_; |
593 ChildMap children_; | 578 ChildMap children_; |
594 | 579 |
595 ResourceType default_resource_type_; | 580 ResourceType default_resource_type_; |
596 bool use_texture_storage_ext_; | 581 bool use_texture_storage_ext_; |
597 bool use_texture_format_bgra_; | 582 bool use_texture_format_bgra_; |
598 bool use_texture_usage_hint_; | 583 bool use_texture_usage_hint_; |
599 bool use_compressed_texture_etc1_; | 584 bool use_compressed_texture_etc1_; |
600 ResourceFormat yuv_resource_format_; | 585 ResourceFormat yuv_resource_format_; |
601 scoped_ptr<TextureUploader> texture_uploader_; | |
602 int max_texture_size_; | 586 int max_texture_size_; |
603 ResourceFormat best_texture_format_; | 587 ResourceFormat best_texture_format_; |
604 | 588 |
605 base::ThreadChecker thread_checker_; | 589 base::ThreadChecker thread_checker_; |
606 | 590 |
607 scoped_refptr<Fence> current_read_lock_fence_; | 591 scoped_refptr<Fence> current_read_lock_fence_; |
608 bool use_rgba_4444_texture_format_; | 592 bool use_rgba_4444_texture_format_; |
609 | 593 |
610 const size_t id_allocation_chunk_size_; | 594 const size_t id_allocation_chunk_size_; |
611 scoped_ptr<IdAllocator> texture_id_allocator_; | 595 scoped_ptr<IdAllocator> texture_id_allocator_; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 return format_gl_data_format[format]; | 654 return format_gl_data_format[format]; |
671 } | 655 } |
672 | 656 |
673 inline GLenum GLInternalFormat(ResourceFormat format) { | 657 inline GLenum GLInternalFormat(ResourceFormat format) { |
674 return GLDataFormat(format); | 658 return GLDataFormat(format); |
675 } | 659 } |
676 | 660 |
677 } // namespace cc | 661 } // namespace cc |
678 | 662 |
679 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 663 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |