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