Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: cc/resources/resource_provider.h

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Folded sync_point into sync_tokens Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 bool ShallowFlushIfSupported(); 163 bool ShallowFlushIfSupported();
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 167
168 // Destroys accounting for the child, deleting all accounted resources. 168 // Destroys accounting for the child, deleting all accounted resources.
169 void DestroyChild(int child); 169 void DestroyChild(int child);
170 170
171 // 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
172 // child. Defaults to true. 172 // child. Defaults to true.
173 void SetChildNeedsSyncPoints(int child, bool needs_sync_points); 173 void SetChildNeedsSyncTokens(int child, bool needs_sync_tokens);
174 174
175 // Gets the child->parent resource ID map. 175 // Gets the child->parent resource ID map.
176 const ResourceIdMap& GetChildToParentMap(int child) const; 176 const ResourceIdMap& GetChildToParentMap(int child) const;
177 177
178 // Prepares resources to be transfered to the parent, moving them to 178 // Prepares resources to be transfered to the parent, moving them to
179 // mailboxes and serializing meta-data into TransferableResources. 179 // mailboxes and serializing meta-data into TransferableResources.
180 // Resources are not removed from the ResourceProvider, but are marked as 180 // Resources are not removed from the ResourceProvider, but are marked as
181 // "in use". 181 // "in use".
182 void PrepareSendToParent(const ResourceIdArray& resources, 182 void PrepareSendToParent(const ResourceIdArray& resources,
183 TransferableResourceArray* transferable_resources); 183 TransferableResourceArray* transferable_resources);
184 184
185 // Receives resources from a child, moving them from mailboxes. Resource IDs 185 // Receives resources from a child, moving them from mailboxes. Resource IDs
186 // passed are in the child namespace, and will be translated to the parent 186 // passed are in the child namespace, and will be translated to the parent
187 // namespace, added to the child->parent map. 187 // namespace, added to the child->parent map.
188 // This adds the resources to the working set in the ResourceProvider without 188 // This adds the resources to the working set in the ResourceProvider without
189 // declaring which resources are in use. Use DeclareUsedResourcesFromChild 189 // declaring which resources are in use. Use DeclareUsedResourcesFromChild
190 // after calling this method to do that. All calls to ReceiveFromChild should 190 // after calling this method to do that. All calls to ReceiveFromChild should
191 // be followed by a DeclareUsedResourcesFromChild. 191 // be followed by a DeclareUsedResourcesFromChild.
192 // NOTE: if the sync_point is set on any TransferableResource, this will 192 // NOTE: if the sync_token is set on any TransferableResource, this will
193 // wait on it. 193 // wait on it.
194 void ReceiveFromChild( 194 void ReceiveFromChild(
195 int child, const TransferableResourceArray& transferable_resources); 195 int child, const TransferableResourceArray& transferable_resources);
196 196
197 // Once a set of resources have been received, they may or may not be used. 197 // Once a set of resources have been received, they may or may not be used.
198 // This declares what set of resources are currently in use from the child, 198 // This declares what set of resources are currently in use from the child,
199 // releasing any other resources back to the child. 199 // releasing any other resources back to the child.
200 void DeclareUsedResourcesFromChild(int child, 200 void DeclareUsedResourcesFromChild(int child,
201 const ResourceIdSet& resources_from_child); 201 const ResourceIdSet& resources_from_child);
202 202
203 // Receives resources from the parent, moving them from mailboxes. Resource 203 // Receives resources from the parent, moving them from mailboxes. Resource
204 // IDs passed are in the child namespace. 204 // IDs passed are in the child namespace.
205 // NOTE: if the sync_point is set on any TransferableResource, this will 205 // NOTE: if the sync_token is set on any TransferableResource, this will
206 // wait on it. 206 // wait on it.
207 void ReceiveReturnsFromParent( 207 void ReceiveReturnsFromParent(
208 const ReturnedResourceArray& transferable_resources); 208 const ReturnedResourceArray& transferable_resources);
209 209
210 // The following lock classes are part of the ResourceProvider API and are 210 // The following lock classes are part of the ResourceProvider API and are
211 // needed to read and write the resource contents. The user must ensure 211 // needed to read and write the resource contents. The user must ensure
212 // that they only use GL locks on GL resources, etc, and this is enforced 212 // that they only use GL locks on GL resources, etc, and this is enforced
213 // by assertions. 213 // by assertions.
214 class CC_EXPORT ScopedReadLockGL { 214 class CC_EXPORT ScopedReadLockGL {
215 public: 215 public:
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 // and has read fences enabled, the resource will not allow writes 413 // and has read fences enabled, the resource will not allow writes
414 // until this fence has passed. 414 // until this fence has passed.
415 void SetReadLockFence(Fence* fence) { current_read_lock_fence_ = fence; } 415 void SetReadLockFence(Fence* fence) { current_read_lock_fence_ = fence; }
416 416
417 // Indicates if we can currently lock this resource for write. 417 // Indicates if we can currently lock this resource for write.
418 bool CanLockForWrite(ResourceId id); 418 bool CanLockForWrite(ResourceId id);
419 419
420 // Indicates if this resource may be used for a hardware overlay plane. 420 // Indicates if this resource may be used for a hardware overlay plane.
421 bool IsOverlayCandidate(ResourceId id); 421 bool IsOverlayCandidate(ResourceId id);
422 422
423 void WaitSyncPointIfNeeded(ResourceId id); 423 void WaitSyncTokenIfNeeded(ResourceId id);
424 424
425 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); 425 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl);
426 426
427 OutputSurface* output_surface() { return output_surface_; } 427 OutputSurface* output_surface() { return output_surface_; }
428 428
429 void ValidateResource(ResourceId id) const; 429 void ValidateResource(ResourceId id) const;
430 430
431 GLenum GetImageTextureTarget(ResourceFormat format); 431 GLenum GetImageTextureTarget(ResourceFormat format);
432 432
433 // base::trace_event::MemoryDumpProvider implementation. 433 // base::trace_event::MemoryDumpProvider implementation.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 typedef base::hash_map<ResourceId, Resource> ResourceMap; 509 typedef base::hash_map<ResourceId, Resource> ResourceMap;
510 510
511 struct Child { 511 struct Child {
512 Child(); 512 Child();
513 ~Child(); 513 ~Child();
514 514
515 ResourceIdMap child_to_parent_map; 515 ResourceIdMap child_to_parent_map;
516 ResourceIdMap parent_to_child_map; 516 ResourceIdMap parent_to_child_map;
517 ReturnCallback return_callback; 517 ReturnCallback return_callback;
518 bool marked_for_deletion; 518 bool marked_for_deletion;
519 bool needs_sync_points; 519 bool needs_sync_tokens;
520 }; 520 };
521 typedef base::hash_map<int, Child> ChildMap; 521 typedef base::hash_map<int, Child> ChildMap;
522 522
523 bool ReadLockFenceHasPassed(const Resource* resource) { 523 bool ReadLockFenceHasPassed(const Resource* resource) {
524 return !resource->read_lock_fence.get() || 524 return !resource->read_lock_fence.get() ||
525 resource->read_lock_fence->HasPassed(); 525 resource->read_lock_fence->HasPassed();
526 } 526 }
527 527
528 Resource* InsertResource(ResourceId id, const Resource& resource); 528 Resource* InsertResource(ResourceId id, const Resource& resource);
529 Resource* GetResource(ResourceId id); 529 Resource* GetResource(ResourceId id);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 // A process-unique ID used for disambiguating memory dumps from different 595 // A process-unique ID used for disambiguating memory dumps from different
596 // resource providers. 596 // resource providers.
597 int tracing_id_; 597 int tracing_id_;
598 598
599 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 599 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
600 }; 600 };
601 601
602 } // namespace cc 602 } // namespace cc
603 603
604 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 604 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698