| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 const gfx::Vector2d& dest_offset); | 146 const gfx::Vector2d& dest_offset); |
| 147 | 147 |
| 148 // Check upload status. | 148 // Check upload status. |
| 149 size_t NumBlockingUploads(); | 149 size_t NumBlockingUploads(); |
| 150 void MarkPendingUploadsAsNonBlocking(); | 150 void MarkPendingUploadsAsNonBlocking(); |
| 151 size_t EstimatedUploadsPerTick(); | 151 size_t EstimatedUploadsPerTick(); |
| 152 void FlushUploads(); | 152 void FlushUploads(); |
| 153 void ReleaseCachedData(); | 153 void ReleaseCachedData(); |
| 154 base::TimeTicks EstimatedUploadCompletionTime(size_t uploads_per_tick); | 154 base::TimeTicks EstimatedUploadCompletionTime(size_t uploads_per_tick); |
| 155 | 155 |
| 156 // Flush all context operations, kicking uploads and ensuring ordering with | |
| 157 // respect to other contexts. | |
| 158 void Flush(); | |
| 159 | |
| 160 // Finish all context operations, causing any pending callbacks to be | |
| 161 // scheduled. | |
| 162 void Finish(); | |
| 163 | |
| 164 // Only flush the command buffer if supported. | 156 // Only flush the command buffer if supported. |
| 165 // Returns true if the shallow flush occurred, false otherwise. | 157 // Returns true if the shallow flush occurred, false otherwise. |
| 166 bool ShallowFlushIfSupported(); | 158 bool ShallowFlushIfSupported(); |
| 167 | 159 |
| 168 // Creates accounting for a child. Returns a child ID. | 160 // Creates accounting for a child. Returns a child ID. |
| 169 int CreateChild(const ReturnCallback& return_callback); | 161 int CreateChild(const ReturnCallback& return_callback); |
| 170 | 162 |
| 171 // Destroys accounting for the child, deleting all accounted resources. | 163 // Destroys accounting for the child, deleting all accounted resources. |
| 172 void DestroyChild(int child); | 164 void DestroyChild(int child); |
| 173 | 165 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 291 |
| 300 private: | 292 private: |
| 301 ResourceProvider* resource_provider_; | 293 ResourceProvider* resource_provider_; |
| 302 ResourceProvider::ResourceId resource_id_; | 294 ResourceProvider::ResourceId resource_id_; |
| 303 SkBitmap sk_bitmap_; | 295 SkBitmap sk_bitmap_; |
| 304 scoped_ptr<SkCanvas> sk_canvas_; | 296 scoped_ptr<SkCanvas> sk_canvas_; |
| 305 | 297 |
| 306 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); | 298 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); |
| 307 }; | 299 }; |
| 308 | 300 |
| 309 // The following class is needed to modify GL resources using GPU | |
| 310 // raster. The user must ensure that they only use GPU raster on | |
| 311 // GL resources while an instance of this class is alive. | |
| 312 class CC_EXPORT ScopedGpuRaster { | |
| 313 public: | |
| 314 ScopedGpuRaster(ResourceProvider* resource_provider); | |
| 315 ~ScopedGpuRaster(); | |
| 316 | |
| 317 private: | |
| 318 ResourceProvider* resource_provider_; | |
| 319 | |
| 320 DISALLOW_COPY_AND_ASSIGN(ScopedGpuRaster); | |
| 321 }; | |
| 322 | |
| 323 class Fence : public base::RefCounted<Fence> { | 301 class Fence : public base::RefCounted<Fence> { |
| 324 public: | 302 public: |
| 325 Fence() {} | 303 Fence() {} |
| 326 virtual bool HasPassed() = 0; | 304 virtual bool HasPassed() = 0; |
| 327 | 305 |
| 328 protected: | 306 protected: |
| 329 friend class base::RefCounted<Fence>; | 307 friend class base::RefCounted<Fence>; |
| 330 virtual ~Fence() {} | 308 virtual ~Fence() {} |
| 331 | 309 |
| 332 private: | 310 private: |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 // specified filter for both minification and magnification. Returns the | 612 // specified filter for both minification and magnification. Returns the |
| 635 // texture target used. The resource must be locked for reading. | 613 // texture target used. The resource must be locked for reading. |
| 636 GLenum BindForSampling(ResourceProvider::ResourceId resource_id, | 614 GLenum BindForSampling(ResourceProvider::ResourceId resource_id, |
| 637 GLenum unit, | 615 GLenum unit, |
| 638 GLenum filter); | 616 GLenum filter); |
| 639 | 617 |
| 640 // Returns NULL if the output_surface_ does not have a ContextProvider. | 618 // Returns NULL if the output_surface_ does not have a ContextProvider. |
| 641 gpu::gles2::GLES2Interface* ContextGL() const; | 619 gpu::gles2::GLES2Interface* ContextGL() const; |
| 642 class GrContext* GrContext() const; | 620 class GrContext* GrContext() const; |
| 643 | 621 |
| 644 void BeginGpuRaster(); | |
| 645 void EndGpuRaster(); | |
| 646 | |
| 647 OutputSurface* output_surface_; | 622 OutputSurface* output_surface_; |
| 648 SharedBitmapManager* shared_bitmap_manager_; | 623 SharedBitmapManager* shared_bitmap_manager_; |
| 649 bool lost_output_surface_; | 624 bool lost_output_surface_; |
| 650 int highp_threshold_min_; | 625 int highp_threshold_min_; |
| 651 ResourceId next_id_; | 626 ResourceId next_id_; |
| 652 ResourceMap resources_; | 627 ResourceMap resources_; |
| 653 int next_child_; | 628 int next_child_; |
| 654 ChildMap children_; | 629 ChildMap children_; |
| 655 | 630 |
| 656 ResourceType default_resource_type_; | 631 ResourceType default_resource_type_; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 return format_gl_data_format[format]; | 694 return format_gl_data_format[format]; |
| 720 } | 695 } |
| 721 | 696 |
| 722 inline GLenum GLInternalFormat(ResourceFormat format) { | 697 inline GLenum GLInternalFormat(ResourceFormat format) { |
| 723 return GLDataFormat(format); | 698 return GLDataFormat(format); |
| 724 } | 699 } |
| 725 | 700 |
| 726 } // namespace cc | 701 } // namespace cc |
| 727 | 702 |
| 728 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 703 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |