Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Side by Side Diff: cc/surfaces/surface_aggregator_test_helpers.cc

Issue 448303002: Use custom ListContainer to allocate DrawQuads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@perftest
Patch Set: change header files to try fix compile error Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/surfaces/surface_aggregator_test_helpers.h" 5 #include "cc/surfaces/surface_aggregator_test_helpers.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "cc/layers/append_quads_data.h" 9 #include "cc/layers/append_quads_data.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 for (size_t i = 0; i < pass_count; ++i) { 99 for (size_t i = 0; i < pass_count; ++i) {
100 Pass pass = passes[i]; 100 Pass pass = passes[i];
101 TestRenderPass* test_pass = 101 TestRenderPass* test_pass =
102 AddRenderPass(pass_list, pass.id, output_rect, root_transform); 102 AddRenderPass(pass_list, pass.id, output_rect, root_transform);
103 for (size_t j = 0; j < pass.quad_count; ++j) { 103 for (size_t j = 0; j < pass.quad_count; ++j) {
104 AddQuadInPass(test_pass, pass.quads[j]); 104 AddQuadInPass(test_pass, pass.quads[j]);
105 } 105 }
106 } 106 }
107 } 107 }
108 108
109 void TestQuadMatchesExpectations(Quad expected_quad, DrawQuad* quad) { 109 void TestQuadMatchesExpectations(Quad expected_quad, const DrawQuad* quad) {
110 switch (expected_quad.material) { 110 switch (expected_quad.material) {
111 case DrawQuad::SOLID_COLOR: { 111 case DrawQuad::SOLID_COLOR: {
112 ASSERT_EQ(DrawQuad::SOLID_COLOR, quad->material); 112 ASSERT_EQ(DrawQuad::SOLID_COLOR, quad->material);
113 113
114 const SolidColorDrawQuad* solid_color_quad = 114 const SolidColorDrawQuad* solid_color_quad =
115 SolidColorDrawQuad::MaterialCast(quad); 115 SolidColorDrawQuad::MaterialCast(quad);
116 116
117 EXPECT_EQ(expected_quad.color, solid_color_quad->color); 117 EXPECT_EQ(expected_quad.color, solid_color_quad->color);
118 break; 118 break;
119 } 119 }
120 case DrawQuad::RENDER_PASS: { 120 case DrawQuad::RENDER_PASS: {
121 ASSERT_EQ(DrawQuad::RENDER_PASS, quad->material); 121 ASSERT_EQ(DrawQuad::RENDER_PASS, quad->material);
122 122
123 const RenderPassDrawQuad* render_pass_quad = 123 const RenderPassDrawQuad* render_pass_quad =
124 RenderPassDrawQuad::MaterialCast(quad); 124 RenderPassDrawQuad::MaterialCast(quad);
125 125
126 EXPECT_EQ(expected_quad.render_pass_id, render_pass_quad->render_pass_id); 126 EXPECT_EQ(expected_quad.render_pass_id, render_pass_quad->render_pass_id);
127 break; 127 break;
128 } 128 }
129 default: 129 default:
130 NOTREACHED(); 130 NOTREACHED();
131 break; 131 break;
132 } 132 }
133 } 133 }
134 134
135 void TestPassMatchesExpectations(Pass expected_pass, RenderPass* pass) { 135 void TestPassMatchesExpectations(Pass expected_pass, const RenderPass* pass) {
136 ASSERT_EQ(expected_pass.quad_count, pass->quad_list.size()); 136 ASSERT_EQ(expected_pass.quad_count, pass->quad_list.size());
137 for (size_t i = 0u; i < pass->quad_list.size(); ++i) { 137 size_t i = 0;
138 for (QuadList::ConstIterator iter = pass->quad_list.begin();
139 iter != pass->quad_list.end();
140 ++iter) {
138 SCOPED_TRACE(base::StringPrintf("Quad number %" PRIuS, i)); 141 SCOPED_TRACE(base::StringPrintf("Quad number %" PRIuS, i));
139 TestQuadMatchesExpectations(expected_pass.quads[i], pass->quad_list.at(i)); 142 TestQuadMatchesExpectations(expected_pass.quads[i], &*iter);
143 ++i;
140 } 144 }
141 } 145 }
142 146
143 void TestPassesMatchExpectations(Pass* expected_passes, 147 void TestPassesMatchExpectations(Pass* expected_passes,
144 size_t expected_pass_count, 148 size_t expected_pass_count,
145 RenderPassList* passes) { 149 const RenderPassList* passes) {
146 ASSERT_EQ(expected_pass_count, passes->size()); 150 ASSERT_EQ(expected_pass_count, passes->size());
147 151
148 for (size_t i = 0; i < passes->size(); ++i) { 152 for (size_t i = 0; i < passes->size(); ++i) {
149 SCOPED_TRACE(base::StringPrintf("Pass number %" PRIuS, i)); 153 SCOPED_TRACE(base::StringPrintf("Pass number %" PRIuS, i));
150 RenderPass* pass = passes->at(i); 154 RenderPass* pass = passes->at(i);
151 TestPassMatchesExpectations(expected_passes[i], pass); 155 TestPassMatchesExpectations(expected_passes[i], pass);
152 } 156 }
153 } 157 }
154 158
155 } // namespace test 159 } // namespace test
156 } // namespace cc 160 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_aggregator_test_helpers.h ('k') | cc/surfaces/surface_aggregator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698