Index: dm/DMTaskRunner.h |
diff --git a/dm/DMTaskRunner.h b/dm/DMTaskRunner.h |
index 8af1b63719af1ec23d639316c7ca20c4d7471b25..c7b40588e99744b021f9923ed5152807ebbf8199 100644 |
--- a/dm/DMTaskRunner.h |
+++ b/dm/DMTaskRunner.h |
@@ -5,26 +5,25 @@ |
#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 from a single thread while parallelizing CPU-bound work. |
+// TaskRunner runs Tasks on one of two threadpools depending on the need for a GrContextFactory. |
+// It's typically a good idea to run fewer GPU threads than CPU threads (go nuts with those). |
namespace DM { |
-class Task; |
+class CpuTask; |
+class GpuTask; |
class TaskRunner : SkNoncopyable { |
public: |
- explicit TaskRunner(int cputhreads); |
+ explicit TaskRunner(int cpuThreads, int gpuThreads); |
- void add(Task* task); |
+ void add(CpuTask* task); |
+ void add(GpuTask* task); |
void wait(); |
- // This can only be safely called from a GPU task's draw() method. |
- GrContextFactory* getGrContextFactory() const { return fGrContextFactory; } |
- |
private: |
- SkThreadPool fMain, fGpu; |
- GrContextFactory* fGrContextFactory; // Created and destroyed on fGpu threadpool. |
+ SkTThreadPool<void> fCpu; |
+ SkTThreadPool<GrContextFactory> fGpu; |
}; |
} // namespace DM |