From 257492c171bcf774477475468b76b4ec4410a3fb Mon Sep 17 00:00:00 2001 From: "danakj@chromium.org" Date: Mon, 4 Mar 2013 22:28:30 +0000 Subject: cc: Make DelegatedRendererLayerImpl::SetRenderPasses() private. This method was now public only for tests. SetFrameData() should be used instead. Implemented a SetFrameDataForRenderPasses() method on the FakeDelegatedRendererLayerImpl class. This class constructs a frame data out of a set of render passes, making a bogus set up TransferableResources for each resource in the render passes, and gives the whole frame to the real DelegatedRendererLayerImpl. Tested by all the delegated renderer layer tests. R=piman BUG=123444 Review URL: https://chromiumcodereview.appspot.com/12388082 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185997 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/test/fake_delegated_renderer_layer_impl.cc | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'cc/test/fake_delegated_renderer_layer_impl.cc') diff --git a/cc/test/fake_delegated_renderer_layer_impl.cc b/cc/test/fake_delegated_renderer_layer_impl.cc index 45e8dd2..3f39472 100644 --- a/cc/test/fake_delegated_renderer_layer_impl.cc +++ b/cc/test/fake_delegated_renderer_layer_impl.cc @@ -4,7 +4,9 @@ #include "cc/test/fake_delegated_renderer_layer_impl.h" +#include "base/bind.h" #include "cc/delegated_frame_data.h" +#include "cc/draw_quad.h" namespace cc { @@ -14,4 +16,31 @@ FakeDelegatedRendererLayerImpl::FakeDelegatedRendererLayerImpl( FakeDelegatedRendererLayerImpl::~FakeDelegatedRendererLayerImpl() {} +static ResourceProvider::ResourceId AddResourceToFrame( + DelegatedFrameData* frame, + ResourceProvider::ResourceId resource_id) { + TransferableResource resource; + resource.id = resource_id; + frame->resource_list.push_back(resource); + return resource_id; +} + +void FakeDelegatedRendererLayerImpl::SetFrameDataForRenderPasses( + ScopedPtrVector* pass_list) { + scoped_ptr delegated_frame(new DelegatedFrameData); + delegated_frame->render_pass_list.swap(*pass_list); + + DrawQuad::ResourceIteratorCallback add_resource_to_frame_callback = + base::Bind(&AddResourceToFrame, + 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) + pass->quad_list[j]->IterateResources(add_resource_to_frame_callback); + } + + TransferableResourceArray resources_for_ack; + SetFrameData(delegated_frame.Pass(), gfx::RectF(), &resources_for_ack); +} + } // namespace cc -- cgit v1.1