diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-09 21:03:45 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-09 21:03:45 +0000 |
commit | 09f6738713c25d6ab583ed0f94722495ee78b05d (patch) | |
tree | e72922013ccaaa1ebf513f6933a40da10362a29d /cc/test/fake_delegated_renderer_layer_impl.cc | |
parent | ad87c674c4bb4200b6c25dec05ac25f3eceba24c (diff) | |
download | chromium_src-09f6738713c25d6ab583ed0f94722495ee78b05d.zip chromium_src-09f6738713c25d6ab583ed0f94722495ee78b05d.tar.gz chromium_src-09f6738713c25d6ab583ed0f94722495ee78b05d.tar.bz2 |
aura: Allow delegated frames to be used by more than one impl layer.
Delegated frames can be used by multiple impl layers within a single
compositor if they are given to different DelegatedRendererLayers which
each send the frame to their impl layer.
Also, they can be given to different DelegatedRendererLayers that live
in different compositors.
So we need something that outlives any DelegatedRendererLayer and will
receive returned resources from the impl side of multiple compositors
and know when to release resoures back to the child compositor, and how
many resources to release.
This patch introduces two new classes:
DelegatedFrameProvider. This class holds a delegated frame and notifies
a single DelegatedRendererLayer (the latest one to attach to it) about
new frames so that it can grab them and display them. If a new
DelegatedRendererLayer steals a DelegatedFrameProvider it will receive
notifications in the future and the first layer will stop updating.
DelegatedFrameResourceCollection. This class holds resources and ref
counts on them to keep track of how many refs are being used by
compositor instances, and how many refs have been received from the
child compositor. Once a resource is not in use anymore by any
compositors, all references passed from the child compositor will
be made available via TakeUnusedResourcesForChildCompositor().
Tests:
LayerTreeHostDelegatedTestTwoImplLayers
LayerTreeHostDelegatedTestRemoveAndAddToTree
LayerTreeHostDelegatedTestRemoveAndChangeResources
R=piman,alexst@chromium.org
BUG=263069
Review URL: https://codereview.chromium.org/26023004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227807 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/fake_delegated_renderer_layer_impl.cc')
-rw-r--r-- | cc/test/fake_delegated_renderer_layer_impl.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/cc/test/fake_delegated_renderer_layer_impl.cc b/cc/test/fake_delegated_renderer_layer_impl.cc index 14d8062..4057736 100644 --- a/cc/test/fake_delegated_renderer_layer_impl.cc +++ b/cc/test/fake_delegated_renderer_layer_impl.cc @@ -8,6 +8,7 @@ #include "cc/output/delegated_frame_data.h" #include "cc/quads/draw_quad.h" #include "cc/resources/returned_resource.h" +#include "cc/trees/layer_tree_impl.h" namespace cc { @@ -24,11 +25,12 @@ scoped_ptr<LayerImpl> FakeDelegatedRendererLayerImpl::CreateLayerImpl( } static ResourceProvider::ResourceId AddResourceToFrame( + ResourceProvider* resource_provider, DelegatedFrameData* frame, ResourceProvider::ResourceId resource_id) { TransferableResource resource; resource.id = resource_id; - resource.target = GL_TEXTURE_2D; + resource.target = resource_provider->TargetForTesting(resource_id); frame->resource_list.push_back(resource); return resource_id; } @@ -50,9 +52,10 @@ void FakeDelegatedRendererLayerImpl::SetFrameDataForRenderPasses( scoped_ptr<DelegatedFrameData> delegated_frame(new DelegatedFrameData); delegated_frame->render_pass_list.swap(*pass_list); + ResourceProvider* resource_provider = layer_tree_impl()->resource_provider(); + DrawQuad::ResourceIteratorCallback add_resource_to_frame_callback = - base::Bind(&AddResourceToFrame, - delegated_frame.get()); + base::Bind(&AddResourceToFrame, resource_provider, delegated_frame.get()); for (size_t i = 0; i < delegated_frame->render_pass_list.size(); ++i) { RenderPass* pass = delegated_frame->render_pass_list[i]; for (size_t j = 0; j < pass->quad_list.size(); ++j) @@ -60,7 +63,7 @@ void FakeDelegatedRendererLayerImpl::SetFrameDataForRenderPasses( } CreateChildIdIfNeeded(base::Bind(&NoopReturnCallback)); - SetFrameData(delegated_frame.Pass(), gfx::RectF()); + SetFrameData(delegated_frame.get(), gfx::RectF()); } } // namespace cc |