[telemetry] Add dtu to content/test/gpu OWNERS for upstream Telemetry changes.
[chromium-blink-merge.git] / cc / test / fake_delegated_renderer_layer_impl.cc
blob458641b1c4649022b5d7d5e049f4c886763dcbff
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"
10 #include "cc/resources/returned_resource.h"
11 #include "cc/trees/layer_tree_impl.h"
13 namespace cc {
15 FakeDelegatedRendererLayerImpl::FakeDelegatedRendererLayerImpl(
16 LayerTreeImpl* tree_impl,
17 int id)
18 : DelegatedRendererLayerImpl(tree_impl, id) {
21 FakeDelegatedRendererLayerImpl::~FakeDelegatedRendererLayerImpl() {}
23 scoped_ptr<LayerImpl> FakeDelegatedRendererLayerImpl::CreateLayerImpl(
24 LayerTreeImpl* tree_impl) {
25 return FakeDelegatedRendererLayerImpl::Create(tree_impl, id());
28 ResourceProvider::ResourceIdSet FakeDelegatedRendererLayerImpl::Resources()
29 const {
30 return ResourcesForTesting();
33 void NoopReturnCallback(const ReturnedResourceArray& returned,
34 BlockingTaskRunner* main_thread_task_runner) {
37 void FakeDelegatedRendererLayerImpl::SetFrameDataForRenderPasses(
38 float device_scale_factor,
39 const RenderPassList& pass_list) {
40 scoped_ptr<DelegatedFrameData> delegated_frame(new DelegatedFrameData);
41 delegated_frame->device_scale_factor = device_scale_factor;
42 RenderPass::CopyAll(pass_list, &delegated_frame->render_pass_list);
44 ResourceProvider* resource_provider = layer_tree_impl()->resource_provider();
46 for (const auto& pass : delegated_frame->render_pass_list) {
47 for (const auto& quad : pass->quad_list) {
48 for (ResourceId resource_id : quad->resources) {
49 TransferableResource resource;
50 resource.id = resource_id;
51 resource.mailbox_holder.texture_target =
52 resource_provider->TargetForTesting(resource_id);
53 delegated_frame->resource_list.push_back(resource);
58 CreateChildIdIfNeeded(base::Bind(&NoopReturnCallback));
59 SetFrameData(delegated_frame.get(), gfx::RectF());
61 } // namespace cc