mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 1 | #include "DMTaskRunner.h" |
| 2 | #include "DMTask.h" |
| 3 | |
| 4 | namespace DM { |
| 5 | |
mtklein | 406654b | 2014-09-03 15:34:37 -0700 | [diff] [blame] | 6 | void TaskRunner::add(CpuTask* task) { fCpuWork.add(task); } |
| 7 | void TaskRunner::add(GpuTask* task) { fGpuWork.push(task); } |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 8 | |
| 9 | void TaskRunner::wait() { |
mtklein | 406654b | 2014-09-03 15:34:37 -0700 | [diff] [blame] | 10 | GrContextFactory factory; |
| 11 | for (int i = 0; i < fGpuWork.count(); i++) { |
| 12 | fGpuWork[i]->run(&factory); |
| 13 | } |
| 14 | fCpuWork.wait(); |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 15 | } |
| 16 | |
| 17 | } // namespace DM |