Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: dm/DMReporter.cpp

Issue 109513002: make tests output spin on the same line by default (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: more refactoring Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gyp/dm.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
OLDNEW
« no previous file with comments | « no previous file | gyp/dm.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698