| OLD | NEW |
| 1 #include "DMTask.h" | 1 #include "DMTask.h" |
| 2 #include "DMTaskRunner.h" | 2 #include "DMTaskRunner.h" |
| 3 #include "SkCommandLineFlags.h" |
| 4 |
| 5 DEFINE_bool(cpu, true, "Master switch for running CPU-bound work."); |
| 6 DEFINE_bool(gpu, true, "Master switch for running GPU-bound work."); |
| 3 | 7 |
| 4 namespace DM { | 8 namespace DM { |
| 5 | 9 |
| 6 Task::Task(Reporter* reporter, TaskRunner* taskRunner) | 10 Task::Task(Reporter* reporter, TaskRunner* taskRunner) |
| 7 : fReporter(reporter) | 11 : fReporter(reporter) |
| 8 , fTaskRunner(taskRunner) | 12 , fTaskRunner(taskRunner) |
| 9 , fDepth(0) { | 13 , fDepth(0) { |
| 10 fReporter->start(); | 14 fReporter->start(); |
| 11 } | 15 } |
| 12 | 16 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 35 | 39 |
| 36 void Task::spawnChild(CpuTask* task) { | 40 void Task::spawnChild(CpuTask* task) { |
| 37 fTaskRunner->add(task); | 41 fTaskRunner->add(task); |
| 38 } | 42 } |
| 39 | 43 |
| 40 CpuTask::CpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, ta
skRunner) {} | 44 CpuTask::CpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, ta
skRunner) {} |
| 41 CpuTask::CpuTask(const Task& parent) : Task(parent) {} | 45 CpuTask::CpuTask(const Task& parent) : Task(parent) {} |
| 42 | 46 |
| 43 void CpuTask::run() { | 47 void CpuTask::run() { |
| 44 this->start(); | 48 this->start(); |
| 45 if (!this->shouldSkip()) { | 49 if (FLAGS_cpu && !this->shouldSkip()) { |
| 46 this->draw(); | 50 this->draw(); |
| 47 } | 51 } |
| 48 this->finish(); | 52 this->finish(); |
| 49 SkDELETE(this); | 53 SkDELETE(this); |
| 50 } | 54 } |
| 51 | 55 |
| 52 GpuTask::GpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, ta
skRunner) {} | 56 GpuTask::GpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, ta
skRunner) {} |
| 53 | 57 |
| 54 void GpuTask::run(GrContextFactory& factory) { | 58 void GpuTask::run(GrContextFactory& factory) { |
| 55 this->start(); | 59 this->start(); |
| 56 if (!this->shouldSkip()) { | 60 if (FLAGS_gpu && !this->shouldSkip()) { |
| 57 this->draw(&factory); | 61 this->draw(&factory); |
| 58 } | 62 } |
| 59 this->finish(); | 63 this->finish(); |
| 60 SkDELETE(this); | 64 SkDELETE(this); |
| 61 } | 65 } |
| 62 | 66 |
| 63 | 67 |
| 64 | 68 |
| 65 } // namespace DM | 69 } // namespace DM |
| OLD | NEW |