perfetto-ui: Parametrize track with data type

At the moment each Track must cast its track data to the correct type.

This CL moves this to the abstract base class by parametrizing Track with
a 'Data' type (as we do with Config).

In addition to avoiding the same boiler plate in each Track this means
TrackController no longer needs a direct dependency on globals.ts.

Also rename MyTrackConfig to Config and MyTrackData to Data as these names
should never leave the my_track directory anyway.

Change-Id: I36741ab00ff178ae76cabc31660cbd1a851c22c7
diff --git a/ui/src/frontend/track.ts b/ui/src/frontend/track.ts
index 64dc3b3..c543ad8 100644
--- a/ui/src/frontend/track.ts
+++ b/ui/src/frontend/track.ts
@@ -13,6 +13,7 @@
 // limitations under the License.
 
 import {TrackState} from '../common/state';
+import {globals} from './globals';
 
 /**
  * This interface forces track implementations to have some static properties.
@@ -32,7 +33,7 @@
 /**
  * The abstract class that needs to be implemented by all tracks.
  */
-export abstract class Track<Config = {}> {
+export abstract class Track<Config = {}, Data = {}> {
   /**
    * Receive data published by the TrackController of this track.
    */
@@ -43,6 +44,10 @@
     return this.trackState.config as Config;
   }
 
+  data(): Data {
+    return globals.trackDataStore.get(this.trackState.id) as Data;
+  }
+
   getHeight(): number {
     return 40;
   }