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

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

Issue 23097005: cc: return resources via a ReturnedResource struct rather than TransferableResource (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review nits Created 7 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « cc/output/delegating_renderer.cc ('k') | cc/resources/resource_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // Resources are not removed from the ResourceProvider, but are marked as 145 // Resources are not removed from the ResourceProvider, but are marked as
146 // "in use". 146 // "in use".
147 void PrepareSendToParent(const ResourceIdArray& resources, 147 void PrepareSendToParent(const ResourceIdArray& resources,
148 TransferableResourceArray* transferable_resources); 148 TransferableResourceArray* transferable_resources);
149 149
150 // Prepares resources to be transfered back to the child, moving them to 150 // Prepares resources to be transfered back to the child, moving them to
151 // mailboxes and serializing meta-data into TransferableResources. 151 // mailboxes and serializing meta-data into TransferableResources.
152 // Resources are removed from the ResourceProvider. Note: the resource IDs 152 // Resources are removed from the ResourceProvider. Note: the resource IDs
153 // passed are in the parent namespace and will be translated to the child 153 // passed are in the parent namespace and will be translated to the child
154 // namespace when returned. 154 // namespace when returned.
155 void PrepareSendToChild(int child, 155 void PrepareSendReturnsToChild(int child,
156 const ResourceIdArray& resources, 156 const ResourceIdArray& resources,
157 TransferableResourceArray* transferable_resources); 157 ReturnedResourceArray* returned_resources);
158 158
159 // Receives resources from a child, moving them from mailboxes. Resource IDs 159 // Receives resources from a child, moving them from mailboxes. Resource IDs
160 // passed are in the child namespace, and will be translated to the parent 160 // passed are in the child namespace, and will be translated to the parent
161 // namespace, added to the child->parent map. 161 // namespace, added to the child->parent map.
162 // NOTE: if the sync_point is set on any TransferableResource, this will 162 // NOTE: if the sync_point is set on any TransferableResource, this will
163 // wait on it. 163 // wait on it.
164 void ReceiveFromChild( 164 void ReceiveFromChild(
165 int child, const TransferableResourceArray& transferable_resources); 165 int child, const TransferableResourceArray& transferable_resources);
166 166
167 // Receives resources from the parent, moving them from mailboxes. Resource 167 // Receives resources from the parent, moving them from mailboxes. Resource
168 // IDs passed are in the child namespace. 168 // IDs passed are in the child namespace.
169 // NOTE: if the sync_point is set on any TransferableResource, this will 169 // NOTE: if the sync_point is set on any TransferableResource, this will
170 // wait on it. 170 // wait on it.
171 void ReceiveFromParent( 171 void ReceiveReturnsFromParent(
172 const TransferableResourceArray& transferable_resources); 172 const ReturnedResourceArray& transferable_resources);
173 173
174 // The following lock classes are part of the ResourceProvider API and are 174 // The following lock classes are part of the ResourceProvider API and are
175 // needed to read and write the resource contents. The user must ensure 175 // needed to read and write the resource contents. The user must ensure
176 // that they only use GL locks on GL resources, etc, and this is enforced 176 // that they only use GL locks on GL resources, etc, and this is enforced
177 // by assertions. 177 // by assertions.
178 class CC_EXPORT ScopedReadLockGL { 178 class CC_EXPORT ScopedReadLockGL {
179 public: 179 public:
180 ScopedReadLockGL(ResourceProvider* resource_provider, 180 ScopedReadLockGL(ResourceProvider* resource_provider,
181 ResourceProvider::ResourceId resource_id); 181 ResourceProvider::ResourceId resource_id);
182 virtual ~ScopedReadLockGL(); 182 virtual ~ScopedReadLockGL();
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 bool ReadLockFenceHasPassed(Resource* resource) { 385 bool ReadLockFenceHasPassed(Resource* resource) {
386 return !resource->read_lock_fence.get() || 386 return !resource->read_lock_fence.get() ||
387 resource->read_lock_fence->HasPassed(); 387 resource->read_lock_fence->HasPassed();
388 } 388 }
389 389
390 explicit ResourceProvider(OutputSurface* output_surface, 390 explicit ResourceProvider(OutputSurface* output_surface,
391 int highp_threshold_min); 391 int highp_threshold_min);
392 392
393 void CleanUpGLIfNeeded(); 393 void CleanUpGLIfNeeded();
394 394
395 Resource* GetResource(ResourceId id);
395 const Resource* LockForRead(ResourceId id); 396 const Resource* LockForRead(ResourceId id);
396 void UnlockForRead(ResourceId id); 397 void UnlockForRead(ResourceId id);
397 const Resource* LockForWrite(ResourceId id); 398 const Resource* LockForWrite(ResourceId id);
398 void UnlockForWrite(ResourceId id); 399 void UnlockForWrite(ResourceId id);
399 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, 400 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap,
400 const Resource* resource); 401 const Resource* resource);
401 402
402 void TransferResource(WebKit::WebGraphicsContext3D* context, 403 void TransferResource(WebKit::WebGraphicsContext3D* context,
403 ResourceId id, 404 ResourceId id,
404 TransferableResource* resource); 405 TransferableResource* resource);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 base::ThreadChecker thread_checker_; 446 base::ThreadChecker thread_checker_;
446 447
447 scoped_refptr<Fence> current_read_lock_fence_; 448 scoped_refptr<Fence> current_read_lock_fence_;
448 449
449 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 450 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
450 }; 451 };
451 452
452 } // namespace cc 453 } // namespace cc
453 454
454 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 455 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW
« no previous file with comments | « cc/output/delegating_renderer.cc ('k') | cc/resources/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698