skia2/dm/DMReporter.cpp
commit-bot@chromium.org 0caa68ab2f DM: add --quiet
This has been handy when tossing in other SkDebugf's.

BUG=
R=bsalomon@google.com

Author: mtklein@google.com

Review URL: https://codereview.chromium.org/49323007

git-svn-id: http://skia.googlecode.com/svn/trunk@11998 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-29 15:02:17 +00:00

39 lines
844 B
C++

#include "DMReporter.h"
#include "SkCommandLineFlags.h"
DEFINE_bool(quiet, false, "If true, don't print status updates.");
namespace DM {
void Reporter::updateStatusLine() const {
if (FLAGS_quiet) {
return;
}
SkString status;
status.printf("\r\033[K%d / %d", this->finished(), this->started());
const int failed = this->failed();
if (failed > 0) {
status.appendf(", %d failed", failed);
}
SkDebugf(status.c_str());
}
int32_t Reporter::failed() const {
SkAutoMutexAcquire reader(&fMutex);
return fFailures.count();
}
void Reporter::fail(SkString name) {
SkAutoMutexAcquire writer(&fMutex);
fFailures.push_back(name);
}
void Reporter::getFailures(SkTArray<SkString>* failures) const {
SkAutoMutexAcquire reader(&fMutex);
*failures = fFailures;
}
} // namespace DM