2013-10-16 13:02:15 +00:00
|
|
|
#ifndef DMTaskRunner_DEFINED
|
|
|
|
#define DMTaskRunner_DEFINED
|
|
|
|
|
2014-02-26 16:31:22 +00:00
|
|
|
#include "GrContextFactory.h"
|
2013-10-16 13:02:15 +00:00
|
|
|
#include "SkThreadPool.h"
|
|
|
|
#include "SkTypes.h"
|
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
// 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).
|
2013-10-16 13:02:15 +00:00
|
|
|
|
|
|
|
namespace DM {
|
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
class CpuTask;
|
|
|
|
class GpuTask;
|
2013-10-16 13:02:15 +00:00
|
|
|
|
|
|
|
class TaskRunner : SkNoncopyable {
|
|
|
|
public:
|
2014-02-28 20:31:31 +00:00
|
|
|
explicit TaskRunner(int cpuThreads, int gpuThreads);
|
2013-10-16 13:02:15 +00:00
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
void add(CpuTask* task);
|
|
|
|
void add(GpuTask* task);
|
2013-10-16 13:02:15 +00:00
|
|
|
void wait();
|
|
|
|
|
|
|
|
private:
|
2014-02-28 20:31:31 +00:00
|
|
|
SkTThreadPool<void> fCpu;
|
|
|
|
SkTThreadPool<GrContextFactory> fGpu;
|
2013-10-16 13:02:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace DM
|
|
|
|
|
|
|
|
#endif // DMTaskRunner_DEFINED
|