DM tweaks

 - Don't print status updates for skipped tasks or count them as pending tasks.
 - Refactor DMReporter a bit for better symmetry, be more explicit about
   how we read atomics (that is, approximately) in printStatus() (née finish()).
 - Remove mutex locking from printStatus().

BUG=skia:
R=halcanary@google.com, mtklein@google.com

Author: mtklein@chromium.org

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

git-svn-id: http://skia.googlecode.com/svn/trunk@14977 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/dm/DM.cpp b/dm/DM.cpp
index c65e1e7..f71a614 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -182,10 +182,7 @@
     }
 }
 
-static void report_failures(const DM::Reporter& reporter) {
-    SkTArray<SkString> failures;
-    reporter.getFailures(&failures);
-
+static void report_failures(const SkTArray<SkString>& failures) {
     if (failures.count() == 0) {
         return;
     }
@@ -194,6 +191,7 @@
     for (int i = 0; i < failures.count(); i++) {
         SkDebugf("  %s\n", failures[i].c_str());
     }
+    SkDebugf("%d failures.\n", failures.count());
 }
 
 template <typename T, typename Registry>
@@ -208,7 +206,7 @@
 
 int tool_main(int argc, char** argv);
 int tool_main(int argc, char** argv) {
-    SkGraphics::Init();
+    SkAutoGraphics ag;
     SkCommandLineFlags::Parse(argc, argv);
 #if SK_ENABLE_INST_COUNT
     gPrintInstCount = FLAGS_leaks;
@@ -260,11 +258,11 @@
     tasks.wait();
 
     SkDebugf("\n");
-    report_failures(reporter);
 
-    SkGraphics::Term();
-
-    return reporter.failed() > 0;
+    SkTArray<SkString> failures;
+    reporter.getFailures(&failures);
+    report_failures(failures);
+    return failures.count() > 0;
 }
 
 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)