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

Issue 24078024: cc: Return resources to child compositor via a Callback. (Closed)

Created:
7 years, 3 months ago by danakj
Modified:
7 years, 2 months ago
Reviewers:
piman
CC:
chromium-reviews, cc-bugs_chromium.org, ajuma, jbauman, Sami (do not use), no sievers
Visibility:
Public.

Description

cc: Return resources to child compositor via a Callback. Currently resources in the ResourceProvider are returned for release back to a child compositor by explicitly calling the method ResourceProvider::PrepareSendReturnsToChild(). This is problematic because we want to return resources immediately if the last reference on the resource is released when a parent compositor gives the resource back to us. TextureMailboxes deal with this gracefully by using a ReleaseCallback in the ResourceProvider that is called when the mailbox is no longer in use. We follow this example to release resources back to child compositors by introducing a ReturnCallback in the ResourceProvider. The ReturnCallback receives an array of resources instead of a single resource per call, allowing us to save on post tasks and Run() invocations. The PrepareSendReturnsToChild is completely replaced by the new callback mechanism. Resources are returned when they are no longer in use in the current frame, and their exported reference count reaches zero (or lost if the child compositor's connection is destroyed). When the DelegatedRendererLayerImpl recieves a new frame, it will always add all the resources into the ResourceProvider so that it can map the resource ids correctly into its own compositor's namespace. Then it will decide if the frame is valid or not. At that point, the DRLI must decide to use the new frame, or continue using the old frame. It does this by calling DeclareUsedResourcesFromChild() on the provider. Any resource not listed in the declaration will become unused and returned to the child as soon as possible. This changes the contract on ResourceProvider such that every call to ReceiveFromChild() should be followed by a DeclareUsedResourcesFromChild() call. For now, DelegatedRendererLayer receives the callbacks about returned resources and just inserts them in its list of resources for the embedder to grab via TakeUnusedResourcesForChildCompositor(). A follow-up step will be to move this callback out into the embedder itself, similar to ReleaseCallback for mailboxes, so that the RenderWidgetHostViewAura can promptly return resources instead of waiting until the next commit to know resources are available. Since resources are now returned to the main thread during commit, we no longer have an extra pending frame of resources sitting on the impl side, and can eliminate all the TODOs in our unit tests about this. Covered by our many existing tests, but also added some new ones: ResourceProviderTest.DeleteExportedResources ResourceProviderTest.DestroyChildWithExportedResources R=piman BUG=263069 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=224640

Patch Set 1 #

Patch Set 2 : deletechild: #

Total comments: 14

Patch Set 3 : deletechild: rebase #

Patch Set 4 : deletechild: add missing file #

Patch Set 5 : deletechild: piman review #

Patch Set 6 : deletechild: selfnits #

Patch Set 7 : deletechild: make is_lost a todo since it's unused for this cl #

Patch Set 8 : deletechild: rebase #

Patch Set 9 : deletechild: fix win #

Patch Set 10 : deletechild: No AndReceiveAck needed, change STP #

Unified diffs Side-by-side diffs Delta from patch set Stats (+771 lines, -346 lines) Patch
M cc/layers/delegated_renderer_layer.h View 1 2 3 4 5 2 chunks +15 lines, -2 lines 0 comments Download
M cc/layers/delegated_renderer_layer.cc View 1 2 3 4 5 chunks +34 lines, -6 lines 0 comments Download
M cc/layers/delegated_renderer_layer_impl.h View 3 chunks +7 lines, -7 lines 0 comments Download
M cc/layers/delegated_renderer_layer_impl.cc View 1 7 chunks +25 lines, -43 lines 0 comments Download
M cc/resources/resource_provider.h View 1 2 3 4 7 chunks +25 lines, -10 lines 0 comments Download
M cc/resources/resource_provider.cc View 1 2 3 4 5 6 7 8 10 chunks +240 lines, -100 lines 0 comments Download
M cc/resources/resource_provider_unittest.cc View 1 2 10 chunks +279 lines, -38 lines 0 comments Download
A cc/resources/return_callback.h View 1 2 3 1 chunk +17 lines, -0 lines 0 comments Download
M cc/test/fake_delegated_renderer_layer_impl.h View 1 chunk +1 line, -3 lines 0 comments Download
M cc/test/fake_delegated_renderer_layer_impl.cc View 1 2 chunks +13 lines, -2 lines 0 comments Download
M cc/test/layer_tree_test.h View 1 chunk +3 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_host_unittest_delegated.cc View 1 5 6 7 8 9 35 chunks +94 lines, -131 lines 0 comments Download
M cc/trees/single_thread_proxy.cc View 1 2 3 4 5 6 7 8 9 4 chunks +18 lines, -4 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
danakj
7 years, 3 months ago (2013-09-19 20:12:43 UTC) #1
piman
There's the threading issue with the callback. Outside of that, there's a couple of places ...
7 years, 3 months ago (2013-09-20 01:55:01 UTC) #2
danakj
https://codereview.chromium.org/24078024/diff/4001/cc/layers/delegated_renderer_layer.cc File cc/layers/delegated_renderer_layer.cc (right): https://codereview.chromium.org/24078024/diff/4001/cc/layers/delegated_renderer_layer.cc#newcode68 cc/layers/delegated_renderer_layer.cc:68: base::Bind(&DelegatedRendererLayer::ReceiveUnusedResources, this)); On 2013/09/20 01:55:01, piman wrote: > Layer ...
7 years, 3 months ago (2013-09-20 14:54:52 UTC) #3
danakj
https://codereview.chromium.org/24078024/diff/4001/cc/layers/delegated_renderer_layer.cc File cc/layers/delegated_renderer_layer.cc (right): https://codereview.chromium.org/24078024/diff/4001/cc/layers/delegated_renderer_layer.cc#newcode68 cc/layers/delegated_renderer_layer.cc:68: base::Bind(&DelegatedRendererLayer::ReceiveUnusedResources, this)); On 2013/09/20 14:54:52, danakj wrote: > On ...
7 years, 3 months ago (2013-09-20 15:39:21 UTC) #4
danakj
PTAL https://codereview.chromium.org/24078024/diff/4001/cc/layers/delegated_renderer_layer.cc File cc/layers/delegated_renderer_layer.cc (right): https://codereview.chromium.org/24078024/diff/4001/cc/layers/delegated_renderer_layer.cc#newcode68 cc/layers/delegated_renderer_layer.cc:68: base::Bind(&DelegatedRendererLayer::ReceiveUnusedResources, this)); On 2013/09/20 15:39:21, danakj wrote: > ...
7 years, 3 months ago (2013-09-20 17:35:12 UTC) #5
piman
lgtm https://codereview.chromium.org/24078024/diff/4001/cc/layers/delegated_renderer_layer_impl.cc File cc/layers/delegated_renderer_layer_impl.cc (right): https://codereview.chromium.org/24078024/diff/4001/cc/layers/delegated_renderer_layer_impl.cc#newcode136 cc/layers/delegated_renderer_layer_impl.cc:136: resource_provider->DeclareUsedResourcesFromChild(child_id_, resources_); On 2013/09/20 14:54:52, danakj wrote: > ...
7 years, 3 months ago (2013-09-20 20:14:57 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/danakj@chromium.org/24078024/19002
7 years, 3 months ago (2013-09-20 20:17:38 UTC) #7
commit-bot: I haz the power
Retried try job too often on win_rel for step(s) browser_tests, content_browsertests, sync_integration_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_rel&number=200578
7 years, 3 months ago (2013-09-21 02:14:51 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/danakj@chromium.org/24078024/19002
7 years, 3 months ago (2013-09-21 15:13:59 UTC) #9
commit-bot: I haz the power
7 years, 2 months ago (2013-09-22 23:30:03 UTC) #10
Message was sent while issue was closed.
Change committed as 224640

Powered by Google App Engine
This is Rietveld 408576698