2013-10-16 13:02:15 +00:00
|
|
|
#ifndef DMReporter_DEFINED
|
|
|
|
#define DMReporter_DEFINED
|
|
|
|
|
|
|
|
#include "SkString.h"
|
|
|
|
#include "SkTArray.h"
|
|
|
|
#include "SkThread.h"
|
2014-03-03 15:44:56 +00:00
|
|
|
#include "SkTime.h"
|
2013-10-16 13:02:15 +00:00
|
|
|
#include "SkTypes.h"
|
|
|
|
|
|
|
|
// Used to report status changes including failures. All public methods are threadsafe.
|
|
|
|
namespace DM {
|
|
|
|
|
|
|
|
class Reporter : SkNoncopyable {
|
|
|
|
public:
|
|
|
|
Reporter() : fStarted(0), fFinished(0) {}
|
|
|
|
|
|
|
|
void start() { sk_atomic_inc(&fStarted); }
|
2014-03-03 15:44:56 +00:00
|
|
|
void finish(SkString name, SkMSec timeMs);
|
2014-02-26 16:31:22 +00:00
|
|
|
void fail(SkString msg);
|
2013-10-16 13:02:15 +00:00
|
|
|
|
|
|
|
int32_t started() const { return fStarted; }
|
|
|
|
int32_t finished() const { return fFinished; }
|
|
|
|
int32_t failed() const;
|
|
|
|
|
|
|
|
void getFailures(SkTArray<SkString>*) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
int32_t fStarted, fFinished;
|
|
|
|
|
|
|
|
mutable SkMutex fMutex; // Guards fFailures.
|
|
|
|
SkTArray<SkString> fFailures;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace DM
|
|
|
|
|
|
|
|
#endif // DMReporter_DEFINED
|