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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 RESOURCE_TYPE_GL_TEXTURE, | 79 RESOURCE_TYPE_GL_TEXTURE, |
80 RESOURCE_TYPE_BITMAP, | 80 RESOURCE_TYPE_BITMAP, |
81 }; | 81 }; |
82 | 82 |
83 static scoped_ptr<ResourceProvider> Create( | 83 static scoped_ptr<ResourceProvider> Create( |
84 OutputSurface* output_surface, | 84 OutputSurface* output_surface, |
85 SharedBitmapManager* shared_bitmap_manager, | 85 SharedBitmapManager* shared_bitmap_manager, |
86 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 86 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
87 BlockingTaskRunner* blocking_main_thread_task_runner, | 87 BlockingTaskRunner* blocking_main_thread_task_runner, |
88 int highp_threshold_min, | 88 int highp_threshold_min, |
89 bool use_rgba_4444_texture_format, | |
90 size_t id_allocation_chunk_size, | 89 size_t id_allocation_chunk_size, |
91 const std::vector<unsigned>& use_image_texture_targets); | 90 const std::vector<unsigned>& use_image_texture_targets); |
92 ~ResourceProvider() override; | 91 ~ResourceProvider() override; |
93 | 92 |
94 void DidLoseOutputSurface() { lost_output_surface_ = true; } | 93 void DidLoseOutputSurface() { lost_output_surface_ = true; } |
95 | 94 |
96 int max_texture_size() const { return max_texture_size_; } | 95 int max_texture_size() const { return max_texture_size_; } |
97 ResourceFormat memory_efficient_texture_format() const { | |
98 return use_rgba_4444_texture_format_ ? RGBA_4444 : best_texture_format_; | |
99 } | |
100 ResourceFormat best_texture_format() const { return best_texture_format_; } | 96 ResourceFormat best_texture_format() const { return best_texture_format_; } |
101 ResourceFormat best_render_buffer_format() const { | 97 ResourceFormat best_render_buffer_format() const { |
102 return best_render_buffer_format_; | 98 return best_render_buffer_format_; |
103 } | 99 } |
104 ResourceFormat yuv_resource_format() const { return yuv_resource_format_; } | 100 ResourceFormat yuv_resource_format() const { return yuv_resource_format_; } |
105 bool use_sync_query() const { return use_sync_query_; } | 101 bool use_sync_query() const { return use_sync_query_; } |
106 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() { | 102 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() { |
107 return gpu_memory_buffer_manager_; | 103 return gpu_memory_buffer_manager_; |
108 } | 104 } |
109 size_t num_resources() const { return resources_.size(); } | 105 size_t num_resources() const { return resources_.size(); } |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 base::trace_event::ProcessMemoryDump* pmd) override; | 437 base::trace_event::ProcessMemoryDump* pmd) override; |
442 | 438 |
443 int tracing_id() const { return tracing_id_; } | 439 int tracing_id() const { return tracing_id_; } |
444 | 440 |
445 protected: | 441 protected: |
446 ResourceProvider(OutputSurface* output_surface, | 442 ResourceProvider(OutputSurface* output_surface, |
447 SharedBitmapManager* shared_bitmap_manager, | 443 SharedBitmapManager* shared_bitmap_manager, |
448 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 444 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
449 BlockingTaskRunner* blocking_main_thread_task_runner, | 445 BlockingTaskRunner* blocking_main_thread_task_runner, |
450 int highp_threshold_min, | 446 int highp_threshold_min, |
451 bool use_rgba_4444_texture_format, | |
452 size_t id_allocation_chunk_size, | 447 size_t id_allocation_chunk_size, |
453 const std::vector<unsigned>& use_image_texture_targets); | 448 const std::vector<unsigned>& use_image_texture_targets); |
454 void Initialize(); | 449 void Initialize(); |
455 | 450 |
456 private: | 451 private: |
457 struct Resource { | 452 struct Resource { |
458 enum Origin { INTERNAL, EXTERNAL, DELEGATED }; | 453 enum Origin { INTERNAL, EXTERNAL, DELEGATED }; |
459 | 454 |
460 ~Resource(); | 455 ~Resource(); |
461 Resource(unsigned texture_id, | 456 Resource(unsigned texture_id, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 bool use_texture_usage_hint_; | 584 bool use_texture_usage_hint_; |
590 bool use_compressed_texture_etc1_; | 585 bool use_compressed_texture_etc1_; |
591 ResourceFormat yuv_resource_format_; | 586 ResourceFormat yuv_resource_format_; |
592 int max_texture_size_; | 587 int max_texture_size_; |
593 ResourceFormat best_texture_format_; | 588 ResourceFormat best_texture_format_; |
594 ResourceFormat best_render_buffer_format_; | 589 ResourceFormat best_render_buffer_format_; |
595 | 590 |
596 base::ThreadChecker thread_checker_; | 591 base::ThreadChecker thread_checker_; |
597 | 592 |
598 scoped_refptr<Fence> current_read_lock_fence_; | 593 scoped_refptr<Fence> current_read_lock_fence_; |
599 bool use_rgba_4444_texture_format_; | |
600 | 594 |
601 const size_t id_allocation_chunk_size_; | 595 const size_t id_allocation_chunk_size_; |
602 scoped_ptr<IdAllocator> texture_id_allocator_; | 596 scoped_ptr<IdAllocator> texture_id_allocator_; |
603 scoped_ptr<IdAllocator> buffer_id_allocator_; | 597 scoped_ptr<IdAllocator> buffer_id_allocator_; |
604 | 598 |
605 bool use_sync_query_; | 599 bool use_sync_query_; |
606 std::vector<unsigned> use_image_texture_targets_; | 600 std::vector<unsigned> use_image_texture_targets_; |
607 | 601 |
608 // A process-unique ID used for disambiguating memory dumps from different | 602 // A process-unique ID used for disambiguating memory dumps from different |
609 // resource providers. | 603 // resource providers. |
610 int tracing_id_; | 604 int tracing_id_; |
611 | 605 |
612 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 606 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
613 }; | 607 }; |
614 | 608 |
615 } // namespace cc | 609 } // namespace cc |
616 | 610 |
617 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 611 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |