OLD | NEW |
1 #include "DMReporter.h" | 1 #include "DMReporter.h" |
2 | 2 |
| 3 #include "SkCommandLineFlags.h" |
| 4 |
| 5 DEFINE_bool(quiet, false, "If true, don't print status updates."); |
| 6 |
3 namespace DM { | 7 namespace DM { |
4 | 8 |
5 void Reporter::updateStatusLine() const { | 9 void Reporter::updateStatusLine() const { |
| 10 if (FLAGS_quiet) { |
| 11 return; |
| 12 } |
| 13 |
6 SkString status; | 14 SkString status; |
7 status.printf("\r\033[K%d / %d", this->finished(), this->started()); | 15 status.printf("\r\033[K%d / %d", this->finished(), this->started()); |
8 const int failed = this->failed(); | 16 const int failed = this->failed(); |
9 if (failed > 0) { | 17 if (failed > 0) { |
10 status.appendf(", %d failed", failed); | 18 status.appendf(", %d failed", failed); |
11 } | 19 } |
12 SkDebugf(status.c_str()); | 20 SkDebugf(status.c_str()); |
13 } | 21 } |
14 | 22 |
15 int32_t Reporter::failed() const { | 23 int32_t Reporter::failed() const { |
16 SkAutoMutexAcquire reader(&fMutex); | 24 SkAutoMutexAcquire reader(&fMutex); |
17 return fFailures.count(); | 25 return fFailures.count(); |
18 } | 26 } |
19 | 27 |
20 void Reporter::fail(SkString name) { | 28 void Reporter::fail(SkString name) { |
21 SkAutoMutexAcquire writer(&fMutex); | 29 SkAutoMutexAcquire writer(&fMutex); |
22 fFailures.push_back(name); | 30 fFailures.push_back(name); |
23 } | 31 } |
24 | 32 |
25 void Reporter::getFailures(SkTArray<SkString>* failures) const { | 33 void Reporter::getFailures(SkTArray<SkString>* failures) const { |
26 SkAutoMutexAcquire reader(&fMutex); | 34 SkAutoMutexAcquire reader(&fMutex); |
27 *failures = fFailures; | 35 *failures = fFailures; |
28 } | 36 } |
29 | 37 |
30 } // namespace DM | 38 } // namespace DM |
OLD | NEW |