Index: cc/resources/resource_provider.h |
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h |
index 88ff2749fd918d06a547a4b04892ef3b8633bc00..bdfaef1af367d46a0d8e94d89f6a21ddde136f34 100644 |
--- a/cc/resources/resource_provider.h |
+++ b/cc/resources/resource_provider.h |
@@ -19,6 +19,7 @@ |
#include "cc/output/context_provider.h" |
#include "cc/output/output_surface.h" |
#include "cc/resources/release_callback.h" |
+#include "cc/resources/return_callback.h" |
#include "cc/resources/single_release_callback.h" |
#include "cc/resources/texture_mailbox.h" |
#include "cc/resources/transferable_resource.h" |
@@ -140,7 +141,7 @@ class CC_EXPORT ResourceProvider { |
bool ShallowFlushIfSupported(); |
// Creates accounting for a child. Returns a child ID. |
- int CreateChild(); |
+ int CreateChild(const ReturnCallback& return_callback); |
// Destroys accounting for the child, deleting all accounted resources. |
void DestroyChild(int child); |
@@ -155,23 +156,25 @@ class CC_EXPORT ResourceProvider { |
void PrepareSendToParent(const ResourceIdArray& resources, |
TransferableResourceArray* transferable_resources); |
- // Prepares resources to be transfered back to the child, moving them to |
- // mailboxes and serializing meta-data into TransferableResources. |
- // Resources are removed from the ResourceProvider. Note: the resource IDs |
- // passed are in the parent namespace and will be translated to the child |
- // namespace when returned. |
- void PrepareSendReturnsToChild(int child, |
- const ResourceIdArray& resources, |
- ReturnedResourceArray* returned_resources); |
- |
// Receives resources from a child, moving them from mailboxes. Resource IDs |
// passed are in the child namespace, and will be translated to the parent |
// namespace, added to the child->parent map. |
+ // This adds the resources to the working set in the ResourceProvider without |
+ // declaring which resources are in use. Use DeclareUsedResourcesFromChild |
+ // after calling this method to do that. All calls to ReceiveFromChild should |
+ // be followed by a DeclareUsedResourcesFromChild. |
// NOTE: if the sync_point is set on any TransferableResource, this will |
// wait on it. |
void ReceiveFromChild( |
int child, const TransferableResourceArray& transferable_resources); |
+ // Once a set of resources have been received, they may or may not be used. |
+ // This declares what set of resources are currently in use from the child, |
+ // releasing any other resources back to the child. |
+ void DeclareUsedResourcesFromChild( |
+ int child, |
+ const ResourceIdArray& resources_from_child); |
+ |
// Receives resources from the parent, moving them from mailboxes. Resource |
// IDs passed are in the child namespace. |
// NOTE: if the sync_point is set on any TransferableResource, this will |
@@ -352,6 +355,7 @@ class CC_EXPORT ResourceProvider { |
GLenum filter, |
GLint wrap_mode); |
+ int child_id; |
unsigned gl_id; |
// Pixel buffer used for set pixels without unnecessary copying. |
unsigned gl_pixel_buffer_id; |
@@ -391,6 +395,8 @@ class CC_EXPORT ResourceProvider { |
ResourceIdMap child_to_parent_map; |
ResourceIdMap parent_to_child_map; |
+ ReturnCallback return_callback; |
+ ResourceIdSet in_use_resources; |
}; |
typedef base::hash_map<int, Child> ChildMap; |
@@ -420,6 +426,9 @@ class CC_EXPORT ResourceProvider { |
ForShutdown, |
}; |
void DeleteResourceInternal(ResourceMap::iterator it, DeleteStyle style); |
+ void DeleteAndReturnUnusedResourcesToChild(Child* child_info, |
+ DeleteStyle style, |
+ const ResourceIdArray& unused); |
void LazyCreate(Resource* resource); |
void LazyAllocate(Resource* resource); |