Reland "Added AutoreleasePool for managing pool memory in testing apps."

This is a reland of a36e089065d3cb4d8af7a12927d55d376a6f65e7

This is only active when Metal is enabled.

Original change's description:
> Added AutoreleasePool for managing pool memory in testing apps.
>
> This is only active on MacOS and iOS -- on other platforms it
> will do nothing as they have no need for autorelease pools.
>
> Bug: skia:8243
> Change-Id: Ib74968dab6e3455a72e726429832101d0d410076
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217126
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: skia:8243
Change-Id: I743a3dcc93b46387a6a330e855c2e8810b482544
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217379
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 32140b8..b5efce4 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1564,6 +1564,7 @@
   test_lib("tool_utils") {
     sources = [
       "tools/AndroidSkDebugToStdOut.cpp",
+      "tools/AutoreleasePool.h",
       "tools/CrashHandler.cpp",
       "tools/DDLPromiseImageHelper.cpp",
       "tools/DDLTileHelper.cpp",
@@ -1591,7 +1592,16 @@
     libs = []
     if (is_ios) {
       sources += [ "tools/ios_utils.m" ]
+      sources += [ "tools/ios_utils.h" ]
+      if (skia_use_metal) {
+        sources += [ "tools/AutoreleasePool.mm" ]
+      }
       libs += [ "Foundation.framework" ]
+    } else if (is_mac) {
+      if (skia_use_metal) {
+        sources += [ "tools/AutoreleasePool.mm" ]
+        libs += [ "Foundation.framework" ]
+      }
     } else if (is_win) {
       libs += [ "DbgHelp.lib" ]
     }