Add signalSyncPoint to the WebGraphicsContext3D command buffer impls.
[chromium-blink-merge.git] / cc / test / fake_delegated_renderer_layer_impl.cc
blob8ae1fa5a4ae8706e908fcad03ad1173c4f7a211d
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/test/fake_delegated_renderer_layer_impl.h"
7 #include "base/bind.h"
8 #include "cc/output/delegated_frame_data.h"
9 #include "cc/quads/draw_quad.h"
11 namespace cc {
13 FakeDelegatedRendererLayerImpl::FakeDelegatedRendererLayerImpl(
14 LayerTreeImpl* tree_impl, int id)
15 : DelegatedRendererLayerImpl(tree_impl, id) {}
17 FakeDelegatedRendererLayerImpl::~FakeDelegatedRendererLayerImpl() {}
19 static ResourceProvider::ResourceId AddResourceToFrame(
20 DelegatedFrameData* frame,
21 ResourceProvider::ResourceId resource_id) {
22 TransferableResource resource;
23 resource.id = resource_id;
24 frame->resource_list.push_back(resource);
25 return resource_id;
28 void FakeDelegatedRendererLayerImpl::SetFrameDataForRenderPasses(
29 ScopedPtrVector<RenderPass>* pass_list) {
30 scoped_ptr<DelegatedFrameData> delegated_frame(new DelegatedFrameData);
31 delegated_frame->render_pass_list.swap(*pass_list);
33 DrawQuad::ResourceIteratorCallback add_resource_to_frame_callback =
34 base::Bind(&AddResourceToFrame,
35 delegated_frame.get());
36 for (size_t i = 0; i < delegated_frame->render_pass_list.size(); ++i) {
37 RenderPass* pass = delegated_frame->render_pass_list[i];
38 for (size_t j = 0; j < pass->quad_list.size(); ++j)
39 pass->quad_list[j]->IterateResources(add_resource_to_frame_callback);
42 TransferableResourceArray resources_for_ack;
43 SetFrameData(delegated_frame.Pass(), gfx::RectF(), &resources_for_ack);
46 } // namespace cc