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

Side by Side Diff: dm/DM.cpp

Issue 1653543002: Revert of Treat bad values passed to --images as a fatal error (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « bench/nanobench.cpp ('k') | gyp/codec.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "CrashHandler.h" 8 #include "CrashHandler.h"
9 #include "DMJsonWriter.h" 9 #include "DMJsonWriter.h"
10 #include "DMSrcSink.h" 10 #include "DMSrcSink.h"
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 }; 512 };
513 513
514 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { 514 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) {
515 if (0 == strcmp(exts[i], ext)) { 515 if (0 == strcmp(exts[i], ext)) {
516 return true; 516 return true;
517 } 517 }
518 } 518 }
519 return false; 519 return false;
520 } 520 }
521 521
522 static bool gather_srcs() { 522 static void gather_srcs() {
523 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex t()) { 523 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex t()) {
524 push_src("gm", "", new GMSrc(r->factory())); 524 push_src("gm", "", new GMSrc(r->factory()));
525 } 525 }
526 for (int i = 0; i < FLAGS_skps.count(); i++) { 526 for (int i = 0; i < FLAGS_skps.count(); i++) {
527 const char* path = FLAGS_skps[i]; 527 const char* path = FLAGS_skps[i];
528 if (sk_isdir(path)) { 528 if (sk_isdir(path)) {
529 SkOSFile::Iter it(path, "skp"); 529 SkOSFile::Iter it(path, "skp");
530 for (SkString file; it.next(&file); ) { 530 for (SkString file; it.next(&file); ) {
531 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str() ))); 531 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str() )));
532 } 532 }
533 } else { 533 } else {
534 push_src("skp", "", new SKPSrc(path)); 534 push_src("skp", "", new SKPSrc(path));
535 } 535 }
536 } 536 }
537 537 static const char* const exts[] = {
538 SkTArray<SkString> images; 538 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico" ,
539 if (!CollectImages(&images)) { 539 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO" ,
540 return false; 540 "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw",
541 } 541 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW",
542 542 };
543 for (auto image : images) { 543 for (int i = 0; i < FLAGS_images.count(); i++) {
544 push_codec_srcs(image); 544 const char* flag = FLAGS_images[i];
545 const char* ext = ""; 545 if (sk_isdir(flag)) {
546 int index = image.findLastOf('.'); 546 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) {
547 if (index >= 0 && (size_t) ++index < image.size()) { 547 SkOSFile::Iter it(flag, exts[j]);
548 ext = &image.c_str()[index]; 548 for (SkString file; it.next(&file); ) {
549 } 549 SkString path = SkOSPath::Join(flag, file.c_str());
550 if (brd_supported(ext)) { 550 push_codec_srcs(path);
551 push_brd_srcs(image); 551 if (brd_supported(exts[j])) {
552 push_brd_srcs(path);
553 }
554 }
555 }
556 } else if (sk_exists(flag)) {
557 // assume that FLAGS_images[i] is a valid image if it is a file.
558 push_codec_srcs(flag);
559 push_brd_srcs(flag);
552 } 560 }
553 } 561 }
554
555 return true;
556 } 562 }
557 563
558 static void push_sink(const SkCommandLineConfig& config, Sink* s) { 564 static void push_sink(const SkCommandLineConfig& config, Sink* s) {
559 SkAutoTDelete<Sink> sink(s); 565 SkAutoTDelete<Sink> sink(s);
560 566
561 // Try a simple Src as a canary. If it fails, skip this sink. 567 // Try a simple Src as a canary. If it fails, skip this sink.
562 struct : public Src { 568 struct : public Src {
563 Error draw(SkCanvas* c) const override { 569 Error draw(SkCanvas* c) const override {
564 c->drawRect(SkRect::MakeWH(1,1), SkPaint()); 570 c->drawRect(SkRect::MakeWH(1,1), SkPaint());
565 return ""; 571 return "";
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing. 1099 JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing.
1094 SkAutoGraphics ag; 1100 SkAutoGraphics ag;
1095 SkTaskGroup::Enabler enabled(FLAGS_threads); 1101 SkTaskGroup::Enabler enabled(FLAGS_threads);
1096 gCreateTypefaceDelegate = &create_from_name; 1102 gCreateTypefaceDelegate = &create_from_name;
1097 1103
1098 start_keepalive(); 1104 start_keepalive();
1099 1105
1100 gather_gold(); 1106 gather_gold();
1101 gather_uninteresting_hashes(); 1107 gather_uninteresting_hashes();
1102 1108
1103 if (!gather_srcs()) { 1109 gather_srcs();
1104 return 1;
1105 }
1106 gather_sinks(); 1110 gather_sinks();
1107 gather_tests(); 1111 gather_tests();
1108 1112
1109 gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTes ts.count(); 1113 gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTes ts.count();
1110 SkDebugf("%d srcs * %d sinks + %d tests == %d tasks\n", 1114 SkDebugf("%d srcs * %d sinks + %d tests == %d tasks\n",
1111 gSrcs.count(), gSinks.count(), gThreadedTests.count() + gGPUTests.c ount(), gPending); 1115 gSrcs.count(), gSinks.count(), gThreadedTests.count() + gGPUTests.c ount(), gPending);
1112 1116
1113 // We try to exploit as much parallelism as is safe. Most Src/Sink pairs ru n on any thread, 1117 // We try to exploit as much parallelism as is safe. Most Src/Sink pairs ru n on any thread,
1114 // but Sinks that identify as part of a particular enclave run serially on a single thread. 1118 // but Sinks that identify as part of a particular enclave run serially on a single thread.
1115 // CPU tests run on any thread. GPU tests depend on --gpu_threading. 1119 // CPU tests run on any thread. GPU tests depend on --gpu_threading.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 Reporter* reporter, 1261 Reporter* reporter,
1258 GrContextFactory* fac tory); 1262 GrContextFactory* fac tory);
1259 } // namespace skiatest 1263 } // namespace skiatest
1260 1264
1261 #if !defined(SK_BUILD_FOR_IOS) 1265 #if !defined(SK_BUILD_FOR_IOS)
1262 int main(int argc, char** argv) { 1266 int main(int argc, char** argv) {
1263 SkCommandLineFlags::Parse(argc, argv); 1267 SkCommandLineFlags::Parse(argc, argv);
1264 return dm_main(); 1268 return dm_main();
1265 } 1269 }
1266 #endif 1270 #endif
OLDNEW
« no previous file with comments | « bench/nanobench.cpp ('k') | gyp/codec.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698