| OLD | NEW |
| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 166 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
| 167 | 167 |
| 168 struct TaggedSrc : public SkAutoTDelete<Src> { | 168 struct TaggedSrc : public SkAutoTDelete<Src> { |
| 169 const char* tag; | 169 const char* tag; |
| 170 const char* options; | 170 const char* options; |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 struct TaggedSink : public SkAutoTDelete<Sink> { | 173 struct TaggedSink : public SkAutoTDelete<Sink> { |
| 174 const char* tag; | 174 const char* tag; |
| 175 const char* options; | |
| 176 SinkType type; | |
| 177 }; | 175 }; |
| 178 | 176 |
| 179 static const bool kMemcpyOK = true; | 177 static const bool kMemcpyOK = true; |
| 180 | 178 |
| 181 static SkTArray<TaggedSrc, kMemcpyOK> gSrcs; | 179 static SkTArray<TaggedSrc, kMemcpyOK> gSrcs; |
| 182 static SkTArray<TaggedSink, kMemcpyOK> gSinks; | 180 static SkTArray<TaggedSink, kMemcpyOK> gSinks; |
| 183 | 181 |
| 184 static bool in_shard() { | 182 static bool in_shard() { |
| 185 static int N = 0; | 183 static int N = 0; |
| 186 return N++ % FLAGS_shards == FLAGS_shard; | 184 return N++ % FLAGS_shards == FLAGS_shard; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 349 |
| 352 SkBitmap bitmap; | 350 SkBitmap bitmap; |
| 353 SkDynamicMemoryWStream stream; | 351 SkDynamicMemoryWStream stream; |
| 354 SkString log; | 352 SkString log; |
| 355 Error err = sink->draw(justOneRect, &bitmap, &stream, &log); | 353 Error err = sink->draw(justOneRect, &bitmap, &stream, &log); |
| 356 if (err.isFatal()) { | 354 if (err.isFatal()) { |
| 357 SkDebugf("Could not run %s: %s\n", tag, err.c_str()); | 355 SkDebugf("Could not run %s: %s\n", tag, err.c_str()); |
| 358 exit(1); | 356 exit(1); |
| 359 } | 357 } |
| 360 | 358 |
| 361 SinkType type = kRaster_SinkType; | |
| 362 if (sink->enclave() == kGPU_Enclave) { type = kGPU_SinkType; } | |
| 363 if (stream.bytesWritten() > 0) { type = kVector_SinkType; } | |
| 364 | |
| 365 TaggedSink& ts = gSinks.push_back(); | 359 TaggedSink& ts = gSinks.push_back(); |
| 366 ts.reset(sink.detach()); | 360 ts.reset(sink.detach()); |
| 367 ts.tag = tag; | 361 ts.tag = tag; |
| 368 ts.type = type; | |
| 369 } | 362 } |
| 370 | 363 |
| 371 static bool gpu_supported() { | 364 static bool gpu_supported() { |
| 372 #if SK_SUPPORT_GPU | 365 #if SK_SUPPORT_GPU |
| 373 return FLAGS_gpu; | 366 return FLAGS_gpu; |
| 374 #else | 367 #else |
| 375 return false; | 368 return false; |
| 376 #endif | 369 #endif |
| 377 } | 370 } |
| 378 | 371 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 const TaggedSrc& src; | 487 const TaggedSrc& src; |
| 495 const TaggedSink& sink; | 488 const TaggedSink& sink; |
| 496 | 489 |
| 497 static void Run(Task* task) { | 490 static void Run(Task* task) { |
| 498 SkString name = task->src->name(); | 491 SkString name = task->src->name(); |
| 499 | 492 |
| 500 // We'll skip drawing this Src/Sink pair if: | 493 // We'll skip drawing this Src/Sink pair if: |
| 501 // - the Src vetoes the Sink; | 494 // - the Src vetoes the Sink; |
| 502 // - this Src / Sink combination is on the blacklist; | 495 // - this Src / Sink combination is on the blacklist; |
| 503 // - it's a dry run. | 496 // - it's a dry run. |
| 504 SkString note(task->src->veto(task->sink.type) ? " (veto)" : ""); | 497 SkString note(task->src->veto(task->sink->flags()) ? " (veto)" : ""); |
| 505 SkString whyBlacklisted = is_blacklisted(task->sink.tag, task->src.tag, | 498 SkString whyBlacklisted = is_blacklisted(task->sink.tag, task->src.tag, |
| 506 task->src.options, name.c_str()
); | 499 task->src.options, name.c_str()
); |
| 507 if (!whyBlacklisted.isEmpty()) { | 500 if (!whyBlacklisted.isEmpty()) { |
| 508 note.appendf(" (--blacklist %s)", whyBlacklisted.c_str()); | 501 note.appendf(" (--blacklist %s)", whyBlacklisted.c_str()); |
| 509 } | 502 } |
| 510 | 503 |
| 511 SkString log; | 504 SkString log; |
| 512 WallTimer timer; | 505 WallTimer timer; |
| 513 timer.start(); | 506 timer.start(); |
| 514 if (!FLAGS_dryRun && note.isEmpty()) { | 507 if (!FLAGS_dryRun && note.isEmpty()) { |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 } | 843 } |
| 851 return 0; | 844 return 0; |
| 852 } | 845 } |
| 853 | 846 |
| 854 #if !defined(SK_BUILD_FOR_IOS) | 847 #if !defined(SK_BUILD_FOR_IOS) |
| 855 int main(int argc, char** argv) { | 848 int main(int argc, char** argv) { |
| 856 SkCommandLineFlags::Parse(argc, argv); | 849 SkCommandLineFlags::Parse(argc, argv); |
| 857 return dm_main(); | 850 return dm_main(); |
| 858 } | 851 } |
| 859 #endif | 852 #endif |
| OLD | NEW |