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

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: fix rebase Created 6 years, 3 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 default: 120 default:
121 NOTREACHED(); 121 NOTREACHED();
122 break; 122 break;
123 } 123 }
124 } 124 }
125 125
126 void TestPassMatchesExpectations(Pass expected_pass, RenderPass* pass) { 126 void TestPassMatchesExpectations(Pass expected_pass, const RenderPass* pass) {
127 ASSERT_EQ(expected_pass.quad_count, pass->quad_list.size()); 127 ASSERT_EQ(expected_pass.quad_count, pass->quad_list.size());
128 for (size_t i = 0u; i < pass->quad_list.size(); ++i) { 128 size_t i = 0;
129 for (QuadList::ConstIterator iter = pass->quad_list.begin();
130 iter != pass->quad_list.end();
131 ++iter) {
129 SCOPED_TRACE(base::StringPrintf("Quad number %" PRIuS, i)); 132 SCOPED_TRACE(base::StringPrintf("Quad number %" PRIuS, i));
130 TestQuadMatchesExpectations(expected_pass.quads[i], pass->quad_list.at(i)); 133 TestQuadMatchesExpectations(expected_pass.quads[i], &*iter);
134 ++i;
131 } 135 }
132 } 136 }
133 137
134 void TestPassesMatchExpectations(Pass* expected_passes, 138 void TestPassesMatchExpectations(Pass* expected_passes,
135 size_t expected_pass_count, 139 size_t expected_pass_count,
136 RenderPassList* passes) { 140 const RenderPassList* passes) {
137 ASSERT_EQ(expected_pass_count, passes->size()); 141 ASSERT_EQ(expected_pass_count, passes->size());
138 142
139 for (size_t i = 0; i < passes->size(); ++i) { 143 for (size_t i = 0; i < passes->size(); ++i) {
140 SCOPED_TRACE(base::StringPrintf("Pass number %" PRIuS, i)); 144 SCOPED_TRACE(base::StringPrintf("Pass number %" PRIuS, i));
141 RenderPass* pass = passes->at(i); 145 RenderPass* pass = passes->at(i);
142 TestPassMatchesExpectations(expected_passes[i], pass); 146 TestPassMatchesExpectations(expected_passes[i], pass);
143 } 147 }
144 } 148 }
145 149
146 } // namespace test 150 } // namespace test
147 } // namespace cc 151 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698