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 |
10 namespace DM { | 11 namespace DM { |
11 | 12 |
12 class Reporter : SkNoncopyable { | 13 class Reporter : SkNoncopyable { |
13 public: | 14 public: |
14 Reporter() : fStarted(0), fFinished(0) {} | 15 Reporter() : fStarted(0), fFinished(0) {} |
15 | 16 |
16 void start() { sk_atomic_inc(&fStarted); } | 17 void start() { sk_atomic_inc(&fStarted); } |
17 void finish(SkString name); | 18 void finish() { sk_atomic_inc(&fFinished); } |
18 void fail(SkString msg); | 19 void fail(SkString name); |
19 | 20 |
20 int32_t started() const { return fStarted; } | 21 int32_t started() const { return fStarted; } |
21 int32_t finished() const { return fFinished; } | 22 int32_t finished() const { return fFinished; } |
22 int32_t failed() const; | 23 int32_t failed() const; |
23 | 24 |
| 25 void updateStatusLine() const; |
| 26 |
24 void getFailures(SkTArray<SkString>*) const; | 27 void getFailures(SkTArray<SkString>*) const; |
25 | 28 |
26 private: | 29 private: |
27 int32_t fStarted, fFinished; | 30 int32_t fStarted, fFinished; |
28 | 31 |
29 mutable SkMutex fMutex; // Guards fFailures. | 32 mutable SkMutex fMutex; // Guards fFailures. |
30 SkTArray<SkString> fFailures; | 33 SkTArray<SkString> fFailures; |
31 }; | 34 }; |
32 | 35 |
33 | 36 |
34 } // namespace DM | 37 } // namespace DM |
35 | 38 |
36 #endif // DMReporter_DEFINED | 39 #endif // DMReporter_DEFINED |
OLD | NEW |