summaryrefslogtreecommitdiffstats
path: root/cc/test/fake_delegated_renderer_layer_impl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc/test/fake_delegated_renderer_layer_impl.cc')
-rw-r--r--cc/test/fake_delegated_renderer_layer_impl.cc29
1 files changed, 29 insertions, 0 deletions
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<RenderPass>* pass_list) {
+ scoped_ptr<DelegatedFrameData> 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