UI: seamlessly migrate to catapult UI for legacy traces

- Add UI code for loading traces in catapult, specifically:
  A) For legacy JSON traces, pass them directly to the old UI.
  B) For newer perfetto traces, convert them to JSON invoking
     trace_to_text into the controller worker and then pass
     them back to the main thread and pass the over to the old
     Catapult UI.
- Build trace_to_text as a WASM module.
- Tweak WASM build files to support >1 wasm targets.
- Add a script to roll Catapult's trace viewer into
  GCS and build it as part of assets.
- Fix some bugs in trace_to_text when building for a
  32-bit target.

Bug: 117977226
Change-Id: I5dced437677b8b978707de5bcef6b02785f32786
diff --git a/tools/install-build-deps b/tools/install-build-deps
index 24a2ce6..bb2fa41 100755
--- a/tools/install-build-deps
+++ b/tools/install-build-deps
@@ -241,6 +241,9 @@
   ),
 ]
 
+# This variable is updated by tools/roll-catapult-trace-viewer.
+CATAPULT_SHA1 = 'ff5d8fd7244680b4d4456c25d5fdc04c76f9ef66'
+
 UI_DEPS = [
   ('buildtools/nodejs.tgz',
    'https://storage.googleapis.com/perfetto/node-v10.3.0-darwin-x64.tar.gz',
@@ -277,6 +280,11 @@
    '1abd630619bb1977ab62095570a113d782a1545d',
    'darwin'
   ),
+  ('buildtools/catapult_trace_viewer.tgz',
+   'https://storage.googleapis.com/perfetto/catapult_trace_viewer-%s.tar.gz' % CATAPULT_SHA1,
+    CATAPULT_SHA1,
+   'all'
+  ),
 ]
 
 ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))