perfetto-ui: Handle resolution is Infinity

This caused a bug when a tab is quickly backgrounded before a trace
has the chance to load.
It's still unclear why the resolution is set to Infinity but this
fix works until the root cause is discovered.

Bug:150151032
Change-Id: Ica29e586372c338f6ee77a86c56e92a4c0d29e5b
diff --git a/ui/src/controller/trace_controller.ts b/ui/src/controller/trace_controller.ts
index 1fc6627..d00321a 100644
--- a/ui/src/controller/trace_controller.ts
+++ b/ui/src/controller/trace_controller.ts
@@ -848,7 +848,7 @@
          from thread
          inner join (
            select
-             cast((ts - ${traceStartNs})/${stepSecNs} as int) as bucket
+             cast((ts - ${traceStartNs})/${stepSecNs} as int) as bucket,
              sum(dur) as utid_sum,
              utid
            from slice
diff --git a/ui/src/controller/track_controller.ts b/ui/src/controller/track_controller.ts
index f3baf80..6acc797 100644
--- a/ui/src/controller/track_controller.ts
+++ b/ui/src/controller/track_controller.ts
@@ -105,7 +105,9 @@
 
   run() {
     const visibleState = globals.state.frontendLocalState.visibleState;
-    if (visibleState === undefined) return;
+    if (visibleState === undefined || visibleState.resolution === undefined ||
+        visibleState.resolution === Infinity)
+      return;
     const dur = visibleState.endSec - visibleState.startSec;
     if (globals.state.visibleTracks.includes(this.trackId) &&
         this.shouldRequestData(visibleState)) {