Chromium Code Reviews| 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 517 #endif | 517 #endif |
| 518 | 518 |
| 519 void WaitSyncTokenIfNeeded(ResourceId id); | 519 void WaitSyncTokenIfNeeded(ResourceId id); |
| 520 | 520 |
| 521 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); | 521 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); |
| 522 | 522 |
| 523 void ValidateResource(ResourceId id) const; | 523 void ValidateResource(ResourceId id) const; |
| 524 | 524 |
| 525 GLenum GetImageTextureTarget(gfx::BufferUsage usage, ResourceFormat format); | 525 GLenum GetImageTextureTarget(gfx::BufferUsage usage, ResourceFormat format); |
| 526 | 526 |
| 527 // Sets whether or not to store resources that are being returned to | |
| 528 // children to return them all at once. Setting this to false will return | |
| 529 // all accumulated resources. | |
| 530 void SetBatchReturnResources(bool aggregate); | |
| 531 | |
| 527 // base::trace_event::MemoryDumpProvider implementation. | 532 // base::trace_event::MemoryDumpProvider implementation. |
| 528 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 533 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
| 529 base::trace_event::ProcessMemoryDump* pmd) override; | 534 base::trace_event::ProcessMemoryDump* pmd) override; |
| 530 | 535 |
| 531 int tracing_id() const { return tracing_id_; } | 536 int tracing_id() const { return tracing_id_; } |
| 532 | 537 |
| 533 private: | 538 private: |
| 534 struct Resource { | 539 struct Resource { |
| 535 enum Origin { INTERNAL, EXTERNAL, DELEGATED }; | 540 enum Origin { INTERNAL, EXTERNAL, DELEGATED }; |
| 536 enum SynchronizationState { | 541 enum SynchronizationState { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 767 BlockingTaskRunner* blocking_main_thread_task_runner_; | 772 BlockingTaskRunner* blocking_main_thread_task_runner_; |
| 768 bool lost_context_provider_; | 773 bool lost_context_provider_; |
| 769 ResourceId next_id_; | 774 ResourceId next_id_; |
| 770 ResourceMap resources_; | 775 ResourceMap resources_; |
| 771 int next_child_; | 776 int next_child_; |
| 772 ChildMap children_; | 777 ChildMap children_; |
| 773 scoped_refptr<Fence> current_read_lock_fence_; | 778 scoped_refptr<Fence> current_read_lock_fence_; |
| 774 std::unique_ptr<TextureIdAllocator> texture_id_allocator_; | 779 std::unique_ptr<TextureIdAllocator> texture_id_allocator_; |
| 775 BufferToTextureTargetMap buffer_to_texture_target_map_; | 780 BufferToTextureTargetMap buffer_to_texture_target_map_; |
| 776 | 781 |
| 782 // Keep track of whether deleted resources should be batched up or returned | |
| 783 // immediately. | |
| 784 bool batch_return_resources_ = false; | |
| 785 // Maps from a child id to the set of resources to be returned to it. | |
| 786 std::map<int, ResourceIdArray> batched_returning_resources_; | |
|
Daniele Castagna
2017/03/24 01:44:43
How many child ids do you expect to have?
Should w
| |
| 787 | |
| 777 base::ThreadChecker thread_checker_; | 788 base::ThreadChecker thread_checker_; |
| 778 | 789 |
| 779 // A process-unique ID used for disambiguating memory dumps from different | 790 // A process-unique ID used for disambiguating memory dumps from different |
| 780 // resource providers. | 791 // resource providers. |
| 781 int tracing_id_; | 792 int tracing_id_; |
| 782 | 793 |
| 783 #if defined(OS_ANDROID) | 794 #if defined(OS_ANDROID) |
| 784 // Set of resource Ids that would like to be notified about promotion hints. | 795 // Set of resource Ids that would like to be notified about promotion hints. |
| 785 ResourceIdSet wants_promotion_hints_set_; | 796 ResourceIdSet wants_promotion_hints_set_; |
| 786 #endif | 797 #endif |
| 787 | 798 |
| 788 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 799 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 789 }; | 800 }; |
| 790 | 801 |
| 791 } // namespace cc | 802 } // namespace cc |
| 792 | 803 |
| 793 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 804 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |