OLD | NEW |
1 #ifndef DMReporter_DEFINED | 1 #ifndef DMReporter_DEFINED |
2 #define DMReporter_DEFINED | 2 #define DMReporter_DEFINED |
3 | 3 |
4 #include "SkString.h" | 4 #include "SkString.h" |
5 #include "SkTArray.h" | 5 #include "SkTArray.h" |
6 #include "SkThread.h" | 6 #include "SkThread.h" |
7 #include "SkTypes.h" | 7 #include "SkTypes.h" |
8 | 8 |
9 // Used to report status changes including failures. All public methods are thr
eadsafe. | 9 // Used to report status changes including failures. All public methods are thr
eadsafe. |
10 | |
11 namespace DM { | 10 namespace DM { |
12 | 11 |
13 class Reporter : SkNoncopyable { | 12 class Reporter : SkNoncopyable { |
14 public: | 13 public: |
15 Reporter() : fStarted(0), fFinished(0) {} | 14 Reporter() : fStarted(0), fFinished(0) {} |
16 | 15 |
17 void start() { sk_atomic_inc(&fStarted); } | 16 void start() { sk_atomic_inc(&fStarted); } |
18 void finish() { sk_atomic_inc(&fFinished); } | 17 void finish(SkString name); |
19 void fail(SkString name); | 18 void fail(SkString msg); |
20 | 19 |
21 int32_t started() const { return fStarted; } | 20 int32_t started() const { return fStarted; } |
22 int32_t finished() const { return fFinished; } | 21 int32_t finished() const { return fFinished; } |
23 int32_t failed() const; | 22 int32_t failed() const; |
24 | 23 |
25 void updateStatusLine() const; | |
26 | |
27 void getFailures(SkTArray<SkString>*) const; | 24 void getFailures(SkTArray<SkString>*) const; |
28 | 25 |
29 private: | 26 private: |
30 int32_t fStarted, fFinished; | 27 int32_t fStarted, fFinished; |
31 | 28 |
32 mutable SkMutex fMutex; // Guards fFailures. | 29 mutable SkMutex fMutex; // Guards fFailures. |
33 SkTArray<SkString> fFailures; | 30 SkTArray<SkString> fFailures; |
34 }; | 31 }; |
35 | 32 |
36 | 33 |
37 } // namespace DM | 34 } // namespace DM |
38 | 35 |
39 #endif // DMReporter_DEFINED | 36 #endif // DMReporter_DEFINED |
OLD | NEW |