OLD | NEW |
1 #ifndef DMTask_DEFINED | 1 #ifndef DMTask_DEFINED |
2 #define DMTask_DEFINED | 2 #define DMTask_DEFINED |
3 | 3 |
4 #include "DMReporter.h" | 4 #include "DMReporter.h" |
5 #include "SkRunnable.h" | 5 #include "SkRunnable.h" |
6 #include "SkThreadPool.h" | 6 #include "SkThreadPool.h" |
7 | 7 |
8 // DM will run() these tasks on one of two threadpools, depending on the result | 8 // DM will run() these tasks on one of two threadpools, depending on the result |
9 // of usesGpu(). The subclasses can call fail() to mark this task as failed, | 9 // of usesGpu(). The subclasses can call fail() to mark this task as failed, |
10 // or make any number of spawnChild() calls to kick off dependent tasks. | 10 // or make any number of spawnChild() calls to kick off dependent tasks. |
(...skipping 16 matching lines...) Expand all Loading... |
27 virtual bool usesGpu() const = 0; | 27 virtual bool usesGpu() const = 0; |
28 virtual bool shouldSkip() const = 0; | 28 virtual bool shouldSkip() const = 0; |
29 virtual SkString name() const = 0; | 29 virtual SkString name() const = 0; |
30 | 30 |
31 // Returns the number of parents above this task. | 31 // Returns the number of parents above this task. |
32 // Top-level tasks return 0, their children 1, and so on. | 32 // Top-level tasks return 0, their children 1, and so on. |
33 int depth() const { return fDepth; } | 33 int depth() const { return fDepth; } |
34 | 34 |
35 protected: | 35 protected: |
36 void spawnChild(Task* task); | 36 void spawnChild(Task* task); |
37 void fail(); | 37 void fail(const char* msg = NULL); |
38 | 38 |
39 private: | 39 private: |
40 // Both unowned. | 40 // Both unowned. |
41 Reporter* fReporter; | 41 Reporter* fReporter; |
42 TaskRunner* fTaskRunner; | 42 TaskRunner* fTaskRunner; |
43 int fDepth; | 43 int fDepth; |
44 | 44 |
45 typedef SkRunnable INHERITED; | 45 typedef SkRunnable INHERITED; |
46 }; | 46 }; |
47 | 47 |
48 } // namespace DM | 48 } // namespace DM |
49 | 49 |
50 #endif // DMTask_DEFINED | 50 #endif // DMTask_DEFINED |
OLD | NEW |