Chromium Code Reviews| Index: dm/DMTaskRunner.h |
| diff --git a/dm/DMTaskRunner.h b/dm/DMTaskRunner.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..292facc970eb43cafd705f256ce49a3992e8b41a |
| --- /dev/null |
| +++ b/dm/DMTaskRunner.h |
| @@ -0,0 +1,29 @@ |
| +#ifndef DMTaskRunner_DEFINED |
| +#define DMTaskRunner_DEFINED |
| + |
| +#include "SkTemplates.h" |
| +#include "SkThreadPool.h" |
| +#include "SkTypes.h" |
| + |
| +// TaskRunner runs Tasks on one of two threadpools depending on the Task's usesGpu() method. |
| +// This lets us drive the GPU with a small number of threads (e.g. 2 or 4 can be faster than 1) |
| +// while not swamping it with requests from the full fleet of threads that CPU-bound tasks run on. |
| + |
| +namespace DM { |
| + |
| +class Task; |
| + |
| +class TaskRunner : SkNoncopyable { |
| +public: |
| + TaskRunner(int cputhreads, int gpuThreads); |
| + |
| + void add(Task* task); |
| + void wait(); |
| + |
| +private: |
| + SkAutoTDelete<SkThreadPool> fMain, fGpu; |
|
scroggo
2013/10/11 21:20:48
Now that you've added wait() to SkThreadPool, you
mtklein
2013/10/15 18:30:53
Absolutely. Done.
|
| +}; |
| + |
| +} // namespace DM |
| + |
| +#endif // DMTaskRunner_DEFINED |