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

Side by Side Diff: dm/DM.cpp

Issue 309483003: DM tweaks (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: note Created 6 years, 6 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
« no previous file with comments | « no previous file | dm/DMReporter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Main binary for DM. 1 // Main binary for DM.
2 // For a high-level overview, please see dm/README. 2 // For a high-level overview, please see dm/README.
3 3
4 #include "SkBenchmark.h" 4 #include "SkBenchmark.h"
5 #include "SkCommandLineFlags.h" 5 #include "SkCommandLineFlags.h"
6 #include "SkForceLinking.h" 6 #include "SkForceLinking.h"
7 #include "SkGraphics.h" 7 #include "SkGraphics.h"
8 #include "SkPicture.h" 8 #include "SkPicture.h"
9 #include "SkString.h" 9 #include "SkString.h"
10 #include "Test.h" 10 #include "Test.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(stream.get())); 175 SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(stream.get()));
176 if (pic.get() == NULL) { 176 if (pic.get() == NULL) {
177 SkDebugf("Could not read %s as an SkPicture.\n", path.c_str()); 177 SkDebugf("Could not read %s as an SkPicture.\n", path.c_str());
178 exit(1); 178 exit(1);
179 } 179 }
180 180
181 tasks->add(SkNEW_ARGS(DM::SKPTask, (reporter, tasks, pic.detach(), filen ame))); 181 tasks->add(SkNEW_ARGS(DM::SKPTask, (reporter, tasks, pic.detach(), filen ame)));
182 } 182 }
183 } 183 }
184 184
185 static void report_failures(const DM::Reporter& reporter) { 185 static void report_failures(const SkTArray<SkString>& failures) {
186 SkTArray<SkString> failures;
187 reporter.getFailures(&failures);
188
189 if (failures.count() == 0) { 186 if (failures.count() == 0) {
190 return; 187 return;
191 } 188 }
192 189
193 SkDebugf("Failures:\n"); 190 SkDebugf("Failures:\n");
194 for (int i = 0; i < failures.count(); i++) { 191 for (int i = 0; i < failures.count(); i++) {
195 SkDebugf(" %s\n", failures[i].c_str()); 192 SkDebugf(" %s\n", failures[i].c_str());
196 } 193 }
194 SkDebugf("%d failures.\n", failures.count());
197 } 195 }
198 196
199 template <typename T, typename Registry> 197 template <typename T, typename Registry>
200 static void append_matching_factories(Registry* head, SkTDArray<typename Registr y::Factory>* out) { 198 static void append_matching_factories(Registry* head, SkTDArray<typename Registr y::Factory>* out) {
201 for (const Registry* reg = head; reg != NULL; reg = reg->next()) { 199 for (const Registry* reg = head; reg != NULL; reg = reg->next()) {
202 SkAutoTDelete<T> forName(reg->factory()(NULL)); 200 SkAutoTDelete<T> forName(reg->factory()(NULL));
203 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, forName->getName())) { 201 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, forName->getName())) {
204 *out->append() = reg->factory(); 202 *out->append() = reg->factory();
205 } 203 }
206 } 204 }
207 } 205 }
208 206
209 int tool_main(int argc, char** argv); 207 int tool_main(int argc, char** argv);
210 int tool_main(int argc, char** argv) { 208 int tool_main(int argc, char** argv) {
211 SkGraphics::Init(); 209 SkAutoGraphics ag;
212 SkCommandLineFlags::Parse(argc, argv); 210 SkCommandLineFlags::Parse(argc, argv);
213 #if SK_ENABLE_INST_COUNT 211 #if SK_ENABLE_INST_COUNT
214 gPrintInstCount = FLAGS_leaks; 212 gPrintInstCount = FLAGS_leaks;
215 #endif 213 #endif
216 GM::SetResourcePath(FLAGS_resources[0]); 214 GM::SetResourcePath(FLAGS_resources[0]);
217 SkBenchmark::SetResourcePath(FLAGS_resources[0]); 215 SkBenchmark::SetResourcePath(FLAGS_resources[0]);
218 Test::SetResourcePath(FLAGS_resources[0]); 216 Test::SetResourcePath(FLAGS_resources[0]);
219 217
220 SkTArray<SkString> configs; 218 SkTArray<SkString> configs;
221 for (int i = 0; i < FLAGS_config.count(); i++) { 219 for (int i = 0; i < FLAGS_config.count(); i++) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 gms.count(), benches.count(), configs.count(), tests.count()); 251 gms.count(), benches.count(), configs.count(), tests.count());
254 DM::Reporter reporter; 252 DM::Reporter reporter;
255 DM::TaskRunner tasks(FLAGS_threads, FLAGS_gpuThreads); 253 DM::TaskRunner tasks(FLAGS_threads, FLAGS_gpuThreads);
256 kick_off_gms(gms, configs, *expectations, &reporter, &tasks); 254 kick_off_gms(gms, configs, *expectations, &reporter, &tasks);
257 kick_off_benches(benches, configs, &reporter, &tasks); 255 kick_off_benches(benches, configs, &reporter, &tasks);
258 kick_off_tests(tests, &reporter, &tasks); 256 kick_off_tests(tests, &reporter, &tasks);
259 kick_off_skps(&reporter, &tasks); 257 kick_off_skps(&reporter, &tasks);
260 tasks.wait(); 258 tasks.wait();
261 259
262 SkDebugf("\n"); 260 SkDebugf("\n");
263 report_failures(reporter);
264 261
265 SkGraphics::Term(); 262 SkTArray<SkString> failures;
266 263 reporter.getFailures(&failures);
267 return reporter.failed() > 0; 264 report_failures(failures);
265 return failures.count() > 0;
268 } 266 }
269 267
270 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 268 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
271 int main(int argc, char** argv) { 269 int main(int argc, char** argv) {
272 return tool_main(argc, argv); 270 return tool_main(argc, argv);
273 } 271 }
274 #endif 272 #endif
OLDNEW
« no previous file with comments | « no previous file | dm/DMReporter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698