Move BenchTimer to tools as Timer

This breaks a bunch of circular dependencies between tools and gm and bench.

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/4ed75287aed6371c6e4a41ffcc78c8a49c9810ed

CQ_EXTRA_TRYBOTS=tryserver.skia:Build-Mac10.7-Clang-Arm7-Debug-iOS-Trybot,Test-Ubuntu12-ShuttleA-GTX660-x86-Debug-Trybot
R=tfarina@chromium.org, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/344213003
diff --git a/gyp/SampleApp.gyp b/gyp/SampleApp.gyp
index abfc8b7..9ced81b 100644
--- a/gyp/SampleApp.gyp
+++ b/gyp/SampleApp.gyp
@@ -150,8 +150,8 @@
         'flags.gyp:flags',
         'lua.gyp:lua',
         'pdf.gyp:pdf',
-        'resources.gyp:resources',
         'skia_lib.gyp:skia_lib',
+        'tools.gyp:resources',
         'views.gyp:views',
         'views_animated.gyp:views_animated',
         'xml.gyp:xml',
diff --git a/gyp/apptype_console.gypi b/gyp/apptype_console.gypi
index cde8779..b993998 100644
--- a/gyp/apptype_console.gypi
+++ b/gyp/apptype_console.gypi
@@ -15,7 +15,7 @@
       [ 'skia_os == "android" and not skia_android_framework', {
         'dependencies': [
           'android_deps.gyp:Android_EntryPoint',
-          'android_system.gyp:skia_launcher',
+          'skia_launcher.gyp:skia_launcher',
         ],
       }],
       [ 'skia_os == "nacl"', {
diff --git a/gyp/bench.gyp b/gyp/bench.gyp
index 15927e6..1c19437 100644
--- a/gyp/bench.gyp
+++ b/gyp/bench.gyp
@@ -9,13 +9,13 @@
       'target_name': 'bench',
       'type': 'executable',
       'dependencies': [
-        'bench_timer',
-        'crash_handler.gyp:CrashHandler',
         'etc1.gyp:libetc1',
         'flags.gyp:flags',
         'jsoncpp.gyp:jsoncpp',
-        'resources.gyp:resources',
         'skia_lib.gyp:skia_lib',
+        'tools.gyp:crash_handler',
+        'tools.gyp:resources',
+        'tools.gyp:timer',
       ],
       'sources': [
         '../bench/BenchLogger.cpp',
@@ -50,63 +50,5 @@
         'gmslides.gypi',
       ],
     },
-    {
-      'target_name' : 'bench_timer',
-      'type': 'static_library',
-      'sources': [
-        '../bench/BenchTimer.h',
-        '../bench/BenchTimer.cpp',
-        '../bench/BenchSysTimer_mach.h',
-        '../bench/BenchSysTimer_mach.cpp',
-        '../bench/BenchSysTimer_posix.h',
-        '../bench/BenchSysTimer_posix.cpp',
-        '../bench/BenchSysTimer_windows.h',
-        '../bench/BenchSysTimer_windows.cpp',
-      ],
-      'include_dirs': [
-        '../src/core',
-        '../src/gpu',
-        '../tools',
-      ],
-      'direct_dependent_settings': {
-        'include_dirs': ['../bench'],
-      },
-      'dependencies': [
-        'skia_lib.gyp:skia_lib',
-      ],
-      'conditions': [
-        [ 'skia_os not in ["mac", "ios"]', {
-          'sources!': [
-            '../bench/BenchSysTimer_mach.h',
-            '../bench/BenchSysTimer_mach.cpp',
-          ],
-        }],
-        [ 'skia_os not in ["linux", "freebsd", "openbsd", "solaris", "android", "chromeos"]', {
-          'sources!': [
-            '../bench/BenchSysTimer_posix.h',
-            '../bench/BenchSysTimer_posix.cpp',
-          ],
-        }],
-        [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos"]', {
-          'link_settings': {
-            'libraries': [
-              '-lrt',
-            ],
-          },
-        }],
-        [ 'skia_os != "win"', {
-          'sources!': [
-            '../bench/BenchSysTimer_windows.h',
-            '../bench/BenchSysTimer_windows.cpp',
-          ],
-        }],
-        ['skia_gpu == 1', {
-          'sources': [
-            '../bench/BenchGpuTimer_gl.h',
-            '../bench/BenchGpuTimer_gl.cpp',
-          ],
-        }],
-      ],
-    }
   ],
 }
diff --git a/gyp/crash_handler.gyp b/gyp/crash_handler.gyp
deleted file mode 100644
index 7e3599c..0000000
--- a/gyp/crash_handler.gyp
+++ /dev/null
@@ -1,18 +0,0 @@
-{
-  'targets': [{
-      'target_name': 'CrashHandler',
-          'type': 'static_library',
-          'sources': [ '../tools/CrashHandler.cpp' ],
-          'dependencies': [ 'skia_lib.gyp:skia_lib' ],
-          'direct_dependent_settings': {
-              'include_dirs': [ '../tools' ],
-          },
-          'all_dependent_settings': {
-              'msvs_settings': {
-                  'VCLinkerTool': {
-                      'AdditionalDependencies': [ 'Dbghelp.lib' ],
-                  }
-              },
-          }
-  }]
-}
diff --git a/gyp/debugger.gyp b/gyp/debugger.gyp
index 84f0397..4add743 100644
--- a/gyp/debugger.gyp
+++ b/gyp/debugger.gyp
@@ -96,8 +96,8 @@
       ],
       'dependencies': [
         'skia_lib.gyp:skia_lib',
-        'bench.gyp:bench_timer',
         'tools.gyp:picture_renderer',
+        'tools.gyp:timer',
       ],
       'conditions': [
         [ 'skia_os == "nacl"', {
diff --git a/gyp/dm.gyp b/gyp/dm.gyp
index f69ffe5..2d02796 100644
--- a/gyp/dm.gyp
+++ b/gyp/dm.gyp
@@ -55,12 +55,12 @@
             '../src/utils/debugger/SkObjectParser.cpp',
         ],
         'dependencies': [
-            'crash_handler.gyp:CrashHandler',
             'etc1.gyp:libetc1',
             'flags.gyp:flags',
             'gputest.gyp:skgputest',
             'jsoncpp.gyp:jsoncpp',
             'skia_lib.gyp:skia_lib',
+            'tools.gyp:crash_handler',
         ],
         'conditions': [
           ['skia_android_framework', {
diff --git a/gyp/gm.gyp b/gyp/gm.gyp
index 0b0054b..fd56e7e 100644
--- a/gyp/gm.gyp
+++ b/gyp/gm.gyp
@@ -5,28 +5,6 @@
   ],
   'targets': [
     {
-      'target_name': 'gm_expectations',
-      'type': 'static_library',
-      'include_dirs' : [
-        '../src/utils/',
-      ],
-      'sources': [
-        '../gm/gm_expectations.h',
-        '../gm/gm_expectations.cpp',
-        '../tools/sk_tool_utils.cpp',
-      ],
-      'dependencies': [
-        'crash_handler.gyp:CrashHandler',
-        'jsoncpp.gyp:jsoncpp',
-        'skia_lib.gyp:skia_lib',
-      ],
-      'direct_dependent_settings': {
-        'include_dirs': [
-          '../gm/',
-        ],
-      },
-    },
-    {
       'target_name': 'gm',
       'type': 'executable',
       'include_dirs' : [
@@ -49,11 +27,12 @@
       'dependencies': [
         'etc1.gyp:libetc1',
         'flags.gyp:flags',
-        'gm.gyp:gm_expectations',
         'jsoncpp.gyp:jsoncpp',
         'pdf.gyp:pdf',
-        'resources.gyp:resources',
         'skia_lib.gyp:skia_lib',
+        'tools.gyp:crash_handler',
+        'tools.gyp:gm_expectations',
+        'tools.gyp:resources',
       ],
       'conditions': [
         ['skia_android_framework', {
diff --git a/gyp/resources.gyp b/gyp/resources.gyp
deleted file mode 100644
index 48e96c3..0000000
--- a/gyp/resources.gyp
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright 2014 Google Inc.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-{
-  'targets': [
-    {
-      'target_name': 'resources',
-      'type': 'static_library',
-      'sources': [
-        '../tools/Resources.cpp',
-        '../tools/Resources.h',
-      ],
-      'dependencies': [
-        'flags.gyp:flags',
-        'skia_lib.gyp:skia_lib',
-      ],
-      'direct_dependent_settings': {
-        'include_dirs': [
-          '../tools/',
-        ],
-      },
-    },
-  ]
-}
diff --git a/gyp/skia_launcher.gyp b/gyp/skia_launcher.gyp
new file mode 100644
index 0000000..d9970b4
--- /dev/null
+++ b/gyp/skia_launcher.gyp
@@ -0,0 +1,3 @@
+{
+  'includes': [ '../platform_tools/android/gyp/skia_launcher.gypi' ]
+}
diff --git a/gyp/tests.gyp b/gyp/tests.gyp
index 80768ef..155207e 100644
--- a/gyp/tests.gyp
+++ b/gyp/tests.gyp
@@ -11,7 +11,7 @@
         'pathops_unittest.gypi',
         'tests.gypi',
       ],
-      'dependencies': [ 'crash_handler.gyp:CrashHandler' ],
+      'dependencies': [ 'tools.gyp:crash_handler' ],
       'sources': [
         '../tests/skia_test.cpp',
       ],
diff --git a/gyp/tests.gypi b/gyp/tests.gypi
index 2a7dddd..f135107 100644
--- a/gyp/tests.gypi
+++ b/gyp/tests.gypi
@@ -20,9 +20,9 @@
     'experimental.gyp:experimental',
     'flags.gyp:flags',
     'pdf.gyp:pdf',
-    'resources.gyp:resources',
     'skia_lib.gyp:skia_lib',
     'tools.gyp:picture_utils',
+    'tools.gyp:resources',
   ],
   'sources': [
     '../tests/Test.cpp',
diff --git a/gyp/tools.gyp b/gyp/tools.gyp
index 5ea1272..eeb210a 100644
--- a/gyp/tools.gyp
+++ b/gyp/tools.gyp
@@ -43,6 +43,86 @@
         ],
       ],
     },
+    {  # This would go in gm.gyp, but it's also used by skimage below.
+      'target_name': 'gm_expectations',
+      'type': 'static_library',
+      'include_dirs' : [ '../src/utils/' ],
+      'sources': [
+        '../gm/gm_expectations.cpp',
+        '../tools/sk_tool_utils.cpp',
+      ],
+      'dependencies': [
+        'jsoncpp.gyp:jsoncpp',
+        'skia_lib.gyp:skia_lib',
+      ],
+      'direct_dependent_settings': {
+        'include_dirs': [ '../gm/' ],
+      },
+    },
+    {
+      'target_name': 'crash_handler',
+        'type': 'static_library',
+        'sources': [ '../tools/CrashHandler.cpp' ],
+        'dependencies': [ 'skia_lib.gyp:skia_lib' ],
+        'direct_dependent_settings': {
+          'include_dirs': [ '../tools' ],
+        },
+        'all_dependent_settings': {
+          'msvs_settings': {
+            'VCLinkerTool': {
+              'AdditionalDependencies': [ 'Dbghelp.lib' ],
+            }
+          },
+        }
+    },
+    {
+      'target_name': 'resources',
+      'type': 'static_library',
+      'sources': [ '../tools/Resources.cpp' ],
+      'dependencies': [
+        'flags.gyp:flags',
+        'skia_lib.gyp:skia_lib',
+      ],
+      'direct_dependent_settings': {
+        'include_dirs': [ '../tools/', ],
+      },
+    },
+    {
+      'target_name' : 'timer',
+      'type': 'static_library',
+      'sources': [
+        '../tools/timer/Timer.cpp',
+        '../tools/timer/TimerData.cpp',
+      ],
+      'include_dirs': [
+        '../src/core',
+        '../src/gpu',
+      ],
+      'direct_dependent_settings': {
+        'include_dirs': ['../tools/timer'],
+      },
+      'dependencies': [
+        'skia_lib.gyp:skia_lib',
+        'jsoncpp.gyp:jsoncpp',
+      ],
+      'conditions': [
+        ['skia_gpu == 1', {
+          'sources': [ '../tools/timer/GpuTimer.cpp' ],
+        }],
+        [ 'skia_os in ["mac", "ios"]', {
+          'sources': [ '../tools/timer/SysTimer_mach.cpp' ],
+        }],
+        [ 'skia_os == "win"', {
+          'sources': [ '../tools/timer/SysTimer_windows.cpp' ],
+        }],
+        [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "android", "chromeos"]', {
+          'sources': [ '../tools/timer/SysTimer_posix.cpp' ],
+        }],
+        [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos"]', {
+          'link_settings': { 'libraries': [ '-lrt' ] },
+        }],
+      ],
+    },
     {
       'target_name': 'skdiff',
       'type': 'executable',
@@ -178,8 +258,8 @@
         '../src/utils/',
       ],
       'dependencies': [
+        'gm_expectations',
         'flags.gyp:flags',
-        'gm.gyp:gm_expectations',
         'jsoncpp.gyp:jsoncpp',
         'skia_lib.gyp:skia_lib',
       ],
@@ -299,14 +379,13 @@
         '../src/lazy/',
       ],
       'dependencies': [
-        'bench.gyp:bench_timer',
-        'crash_handler.gyp:CrashHandler',
+        'timer',
+        'crash_handler',
         'flags.gyp:flags',
         'jsoncpp.gyp:jsoncpp',
         'skia_lib.gyp:skia_lib',
         'tools.gyp:picture_renderer',
         'tools.gyp:picture_utils',
-        'tools.gyp:timer_data',
       ],
     },
     {
@@ -322,7 +401,7 @@
         '../src/lazy',
       ],
       'dependencies': [
-        'bench.gyp:bench_timer',
+        'timer',
         'flags.gyp:flags',
         'skia_lib.gyp:skia_lib',
       ],
@@ -338,7 +417,7 @@
         '../src/images',
       ],
       'dependencies': [
-        'bench.gyp:bench_timer',
+        'timer',
         'flags.gyp:flags',
         'skia_lib.gyp:skia_lib',
       ],
@@ -357,7 +436,7 @@
         '../src/lazy',
       ],
       'dependencies': [
-        'bench.gyp:bench_timer',
+        'timer',
         'flags.gyp:flags',
         'skia_lib.gyp:skia_lib',
       ],
@@ -505,9 +584,8 @@
         # Bench code:
       ],
       'dependencies': [
-        'bench.gyp:bench_timer',
+        'timer',
         'flags.gyp:flags',
-        'tools.gyp:timer_data',
         'skia_lib.gyp:skia_lib',
         'tools.gyp:picture_renderer',
         'tools.gyp:picture_utils',
@@ -544,17 +622,6 @@
         'skia_lib.gyp:skia_lib',
       ],
     },
-    {
-      'target_name': 'timer_data',
-      'type': 'static_library',
-      'sources': [
-        '../bench/TimerData.cpp',
-      ],
-      'dependencies': [
-        'skia_lib.gyp:skia_lib',
-        'jsoncpp.gyp:jsoncpp'
-      ]
-    }
   ],
   'conditions': [
     ['skia_shared_lib',