| OLD | NEW |
| 1 #include "DMReporter.h" | 1 #include "DMReporter.h" |
| 2 | 2 |
| 3 #include "SkCommandLineFlags.h" | 3 #include "SkCommandLineFlags.h" |
| 4 #include "OverwriteLine.h" | 4 #include "OverwriteLine.h" |
| 5 | 5 |
| 6 DEFINE_bool(quiet, false, "If true, don't print status updates."); | 6 DEFINE_bool2(quiet, q, false, "If true, don't print status updates."); |
| 7 DEFINE_bool2(verbose, v, false, "If true, print status updates one-per-line."); |
| 7 | 8 |
| 8 namespace DM { | 9 namespace DM { |
| 9 | 10 |
| 10 void Reporter::updateStatusLine() const { | 11 void Reporter::finish(SkString name) { |
| 12 sk_atomic_inc(&fFinished); |
| 13 |
| 11 if (FLAGS_quiet) { | 14 if (FLAGS_quiet) { |
| 12 return; | 15 return; |
| 13 } | 16 } |
| 14 | 17 |
| 15 SkString status; | 18 SkString status; |
| 16 status.printf("%s%d tasks left", kSkOverwriteLine, this->started() - this->f
inished()); | 19 status.printf("%s%d tasks left", |
| 20 FLAGS_verbose ? "\n" : kSkOverwriteLine, |
| 21 this->started() - this->finished()); |
| 17 const int failed = this->failed(); | 22 const int failed = this->failed(); |
| 18 if (failed > 0) { | 23 if (failed > 0) { |
| 19 status.appendf(", %d failed", failed); | 24 status.appendf(", %d failed", failed); |
| 20 } | 25 } |
| 26 status.appendf("\t[%s done]", name.c_str()); |
| 21 SkDebugf(status.c_str()); | 27 SkDebugf(status.c_str()); |
| 22 } | 28 } |
| 23 | 29 |
| 24 int32_t Reporter::failed() const { | 30 int32_t Reporter::failed() const { |
| 25 SkAutoMutexAcquire reader(&fMutex); | 31 SkAutoMutexAcquire reader(&fMutex); |
| 26 return fFailures.count(); | 32 return fFailures.count(); |
| 27 } | 33 } |
| 28 | 34 |
| 29 void Reporter::fail(SkString name) { | 35 void Reporter::fail(SkString msg) { |
| 30 SkAutoMutexAcquire writer(&fMutex); | 36 SkAutoMutexAcquire writer(&fMutex); |
| 31 fFailures.push_back(name); | 37 fFailures.push_back(msg); |
| 32 } | 38 } |
| 33 | 39 |
| 34 void Reporter::getFailures(SkTArray<SkString>* failures) const { | 40 void Reporter::getFailures(SkTArray<SkString>* failures) const { |
| 35 SkAutoMutexAcquire reader(&fMutex); | 41 SkAutoMutexAcquire reader(&fMutex); |
| 36 *failures = fFailures; | 42 *failures = fFailures; |
| 37 } | 43 } |
| 38 | 44 |
| 39 } // namespace DM | 45 } // namespace DM |
| OLD | NEW |