DM: --gpu and --cpu should only control top-level tasks.

This fixes a bug where we run some Android bots with --nocpu, and the
current behavior disables the (CPU-bound) WriteTasks the GPU bound GM
runs spawn off.  The WriteTasks don't run and we end up with "null" in
our .json files.

Tested locally: out/Release/dm --nocpu -w /tmp/out; ls /tmp/out
  dm.json  gpu/

BUG=skia:2938
R=jcgregorio@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/578033002
This commit is contained in:
mtklein 2014-09-17 12:26:18 -07:00 committed by Commit bot
parent 6a5c7085bc
commit 53e0be6d2b

View File

@ -46,7 +46,9 @@ CpuTask::CpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, ta
CpuTask::CpuTask(const Task& parent) : Task(parent) {}
void CpuTask::run() {
if (FLAGS_cpu && !this->shouldSkip()) {
// If the task says skip, or if we're starting a top-level CPU task and we don't want to, skip.
const bool skip = this->shouldSkip() || (this->depth() == 0 && !FLAGS_cpu);
if (!skip) {
this->start();
if (!FLAGS_dryRun) this->draw();
this->finish();
@ -64,7 +66,9 @@ void CpuTask::spawnChild(CpuTask* task) {
GpuTask::GpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, taskRunner) {}
void GpuTask::run(GrContextFactory* factory) {
if (FLAGS_gpu && !this->shouldSkip()) {
// If the task says skip, or if we're starting a top-level GPU task and we don't want to, skip.
const bool skip = this->shouldSkip() || (this->depth() == 0 && !FLAGS_gpu);
if (!skip) {
this->start();
if (!FLAGS_dryRun) this->draw(factory);
this->finish();