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 "SkTime.h" |
7 #include "SkTypes.h" | 8 #include "SkTypes.h" |
8 | 9 |
9 // Used to report status changes including failures. All public methods are thr
eadsafe. | 10 // Used to report status changes including failures. All public methods are thr
eadsafe. |
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(SkString name, SkMSec timeMs); |
18 void fail(SkString msg); | 19 void fail(SkString msg); |
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 |
24 void getFailures(SkTArray<SkString>*) const; | 25 void getFailures(SkTArray<SkString>*) const; |
25 | 26 |
26 private: | 27 private: |
27 int32_t fStarted, fFinished; | 28 int32_t fStarted, fFinished; |
28 | 29 |
29 mutable SkMutex fMutex; // Guards fFailures. | 30 mutable SkMutex fMutex; // Guards fFailures. |
30 SkTArray<SkString> fFailures; | 31 SkTArray<SkString> fFailures; |
31 }; | 32 }; |
32 | 33 |
33 | 34 |
34 } // namespace DM | 35 } // namespace DM |
35 | 36 |
36 #endif // DMReporter_DEFINED | 37 #endif // DMReporter_DEFINED |
OLD | NEW |