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