add --dryRun flag to dm

BUG=2294
R=mtklein@google.com

Author: humper@google.com

Review URL: https://codereview.chromium.org/305963007

git-svn-id: http://skia.googlecode.com/svn/trunk@14999 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/dm/DMTask.cpp b/dm/DMTask.cpp
index e32249d..54e7df3 100644
--- a/dm/DMTask.cpp
+++ b/dm/DMTask.cpp
@@ -5,6 +5,8 @@
 DEFINE_bool(cpu, true, "Master switch for running CPU-bound work.");
 DEFINE_bool(gpu, true, "Master switch for running GPU-bound work.");
 
+DECLARE_bool(dryRun);
+
 namespace DM {
 
 Task::Task(Reporter* reporter, TaskRunner* taskRunner)
@@ -51,7 +53,7 @@
 void CpuTask::run() {
     if (FLAGS_cpu && !this->shouldSkip()) {
         this->start();
-        this->draw();
+        if (!FLAGS_dryRun) this->draw();
         this->finish();
     }
     SkDELETE(this);
@@ -69,7 +71,7 @@
 void GpuTask::run(GrContextFactory& factory) {
     if (FLAGS_gpu && !this->shouldSkip()) {
         this->start();
-        this->draw(&factory);
+        if (!FLAGS_dryRun) this->draw(&factory);
         this->finish();
     }
     SkDELETE(this);