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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // the resource). | 156 // the resource). |
157 void CopyToResource(ResourceId id, | 157 void CopyToResource(ResourceId id, |
158 const uint8_t* image, | 158 const uint8_t* image, |
159 const gfx::Size& image_size); | 159 const gfx::Size& image_size); |
160 | 160 |
161 // Generates sync tokesn for resources which need a sync token. | 161 // Generates sync tokesn for resources which need a sync token. |
162 void GenerateSyncTokenForResource(ResourceId resource_id); | 162 void GenerateSyncTokenForResource(ResourceId resource_id); |
163 void GenerateSyncTokenForResources(const ResourceIdArray& resource_ids); | 163 void GenerateSyncTokenForResources(const ResourceIdArray& resource_ids); |
164 | 164 |
165 // Creates accounting for a child. Returns a child ID. | 165 // Creates accounting for a child. Returns a child ID. |
166 int CreateChild(const ReturnCallback& return_callback, | 166 int CreateChild(const ReturnCallback& return_callback); |
167 int gpu_memory_buffer_client_id); | |
168 | 167 |
169 // Destroys accounting for the child, deleting all accounted resources. | 168 // Destroys accounting for the child, deleting all accounted resources. |
170 void DestroyChild(int child); | 169 void DestroyChild(int child); |
171 | 170 |
172 // Sets whether resources need sync points set on them when returned to this | 171 // Sets whether resources need sync points set on them when returned to this |
173 // child. Defaults to true. | 172 // child. Defaults to true. |
174 void SetChildNeedsSyncTokens(int child, bool needs_sync_tokens); | 173 void SetChildNeedsSyncTokens(int child, bool needs_sync_tokens); |
175 | 174 |
176 // Gets the child->parent resource ID map. | 175 // Gets the child->parent resource ID map. |
177 const ResourceIdMap& GetChildToParentMap(int child) const; | 176 const ResourceIdMap& GetChildToParentMap(int child) const; |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 using ResourceMap = std::unordered_map<ResourceId, Resource>; | 598 using ResourceMap = std::unordered_map<ResourceId, Resource>; |
600 | 599 |
601 struct Child { | 600 struct Child { |
602 Child(); | 601 Child(); |
603 Child(const Child& other); | 602 Child(const Child& other); |
604 ~Child(); | 603 ~Child(); |
605 | 604 |
606 ResourceIdMap child_to_parent_map; | 605 ResourceIdMap child_to_parent_map; |
607 ResourceIdMap parent_to_child_map; | 606 ResourceIdMap parent_to_child_map; |
608 ReturnCallback return_callback; | 607 ReturnCallback return_callback; |
609 int gpu_memory_buffer_client_id; | |
610 bool marked_for_deletion; | 608 bool marked_for_deletion; |
611 bool needs_sync_tokens; | 609 bool needs_sync_tokens; |
612 }; | 610 }; |
613 using ChildMap = std::unordered_map<int, Child>; | 611 using ChildMap = std::unordered_map<int, Child>; |
614 | 612 |
615 bool ReadLockFenceHasPassed(const Resource* resource) { | 613 bool ReadLockFenceHasPassed(const Resource* resource) { |
616 return !resource->read_lock_fence.get() || | 614 return !resource->read_lock_fence.get() || |
617 resource->read_lock_fence->HasPassed(); | 615 resource->read_lock_fence->HasPassed(); |
618 } | 616 } |
619 | 617 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 // A process-unique ID used for disambiguating memory dumps from different | 697 // A process-unique ID used for disambiguating memory dumps from different |
700 // resource providers. | 698 // resource providers. |
701 int tracing_id_; | 699 int tracing_id_; |
702 | 700 |
703 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 701 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
704 }; | 702 }; |
705 | 703 |
706 } // namespace cc | 704 } // namespace cc |
707 | 705 |
708 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 706 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |