Bootstrap a very simple viewer implementation in CanvasKit

Adds a "viewer" option to the build system that brings in tooling code
and sample code. Adds a very simple "MakeSlide" binding that knows
how to create the WavyPathText sample slide. Adds viewer.html with
code to animate viewer slides.

This can hopefully be the starting point for future work on bringing
viewer to CanvasKit.

Change-Id: Ia26e08726384b40b3f544fe8254f430dc9db08db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278892
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index b457731..9112d09 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1423,7 +1423,7 @@
 
     # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
     # in GrContextFactory. This only matters for OSes that can run Vulkan.
-    if (skia_use_gl || skia_use_vulkan) {
+    if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
       if (is_android || skia_use_egl) {
         sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
         libs += [ "EGL" ]
@@ -1531,7 +1531,6 @@
     sources = [
       "tools/AndroidSkDebugToStdOut.cpp",
       "tools/AutoreleasePool.h",
-      "tools/CrashHandler.cpp",
       "tools/DDLPromiseImageHelper.cpp",
       "tools/DDLTileHelper.cpp",
       "tools/LsanSuppressions.cpp",
@@ -1559,6 +1558,9 @@
       "tools/timer/TimeUtils.h",
       "tools/timer/Timer.cpp",
     ]
+    if (target_cpu != "wasm") {
+      sources += [ "tools/CrashHandler.cpp" ]
+    }
     libs = []
     if (is_ios) {
       sources += [ "tools/ios_utils.m" ]
@@ -1797,30 +1799,33 @@
     ]
   }
 
-  if (target_cpu != "wasm") {
-    import("gn/samples.gni")
-    test_lib("samples") {
-      sources = samples_sources
-      public_deps = [
-        ":tool_utils",
-      ]
-      deps = [
-        ":experimental_svg_model",
-        ":flags",
-        ":gpu_tool_utils",
-        ":xml",
-        "modules/skparagraph:samples",
-        "modules/skshaper",
-      ]
-
-      if (skia_use_lua) {
-        sources += [ "samplecode/SampleLua.cpp" ]
-        deps += [
-          ":lua",
-          "//third_party/lua",
-        ]
-      }
+  import("gn/samples.gni")
+  test_lib("samples") {
+    sources = samples_sources
+    if (skia_enable_ccpr) {
+      sources += samples_sources_ccpr
     }
+    public_deps = [
+      ":tool_utils",
+    ]
+    deps = [
+      ":experimental_svg_model",
+      ":flags",
+      ":gpu_tool_utils",
+      ":xml",
+      "modules/skparagraph:samples",
+      "modules/skshaper",
+    ]
+
+    if (skia_use_lua) {
+      sources += [ "samplecode/SampleLua.cpp" ]
+      deps += [
+        ":lua",
+        "//third_party/lua",
+      ]
+    }
+  }
+  if (target_cpu != "wasm") {
     test_app("imgcvt") {
       sources = [
         "tools/imgcvt.cpp",
@@ -2595,6 +2600,14 @@
       ":skia",
     ]
   }
+
+  group("modules_testonly") {
+    testonly = true
+    deps = []
+    if (target_cpu == "wasm") {
+      deps += [ "modules/canvaskit:viewer_wasm" ]
+    }
+  }
 }
 
 if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {