nanobench: lazily decode bitmaps from SKPs

This makes it considerably cheaper to run SKP recording benchmarks, without
affecting their measurements and without really affecting SKP playback
benchmarks at all.

On my machine, running out/Release/nanobench --match skp --config nondrendering
drops in run time from 6.7s to 2.5s, and the peak RAM usage drops from 129M to 50M.

I'm strongly considering making this lazy decoding the default.

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

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/572933006
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 67646c2..eff0b2f 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -10,6 +10,7 @@
 #include "Benchmark.h"
 #include "CrashHandler.h"
 #include "GMBench.h"
+#include "LazyDecodeBitmap.h"
 #include "ProcStats.h"
 #include "ResultsWriter.h"
 #include "RecordingBench.h"
@@ -450,7 +451,7 @@
             return false;
         }
 
-        pic->reset(SkPicture::CreateFromStream(stream.get()));
+        pic->reset(SkPicture::CreateFromStream(stream.get(), sk_tools::LazyDecodeBitmap));
         if (pic->get() == NULL) {
             SkDebugf("Could not read %s as an SkPicture.\n", path);
             return false;
diff --git a/gyp/bench.gyp b/gyp/bench.gyp
index 26849d5..08f173c 100644
--- a/gyp/bench.gyp
+++ b/gyp/bench.gyp
@@ -9,11 +9,12 @@
       'target_name': 'nanobench',
       'type': 'executable',
       'sources': [
-        '../gm/gm.cpp',
         '../bench/GMBench.cpp',
         '../bench/RecordingBench.cpp',
         '../bench/SKPBench.cpp',
         '../bench/nanobench.cpp',
+        '../gm/gm.cpp',
+        '../tools/LazyDecodeBitmap.cpp',
       ],
       'includes': [
         'bench.gypi',
diff --git a/gyp/iOSShell.gyp b/gyp/iOSShell.gyp
index ac2ed30..20c4994 100644
--- a/gyp/iOSShell.gyp
+++ b/gyp/iOSShell.gyp
@@ -23,6 +23,7 @@
             '../bench/SKPBench.cpp',
             '../bench/nanobench.cpp',
             '../tests/skia_test.cpp',
+            '../tools/LazyDecodeBitmap.cpp',
             '../tools/iOSShell.cpp',
             '../src/views/mac/SkEventNotifier.mm',
             '../experimental/iOSSampleApp/SkiOSSampleApp-Base.xcconfig',