summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/catapult/tracing/tracing/ui/tracks/container_to_track_map.html
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/catapult/tracing/tracing/ui/tracks/container_to_track_map.html')
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/container_to_track_map.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/container_to_track_map.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/container_to_track_map.html
new file mode 100644
index 00000000000..ecaac0dd3b1
--- /dev/null
+++ b/chromium/third_party/catapult/tracing/tracing/ui/tracks/container_to_track_map.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<!--
+Copyright (c) 2015 The Chromium Authors. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+-->
+
+<link rel="import" href="/tracing/base/base.html">
+
+<script>
+'use strict';
+
+tr.exportTo('tr.ui.tracks', function() {
+ /**
+ * ContainerToTrackMap is a class to handle building and accessing a map
+ * between an EventContainer's stableId and its handling track.
+ *
+ * @constructor
+ */
+ function ContainerToTrackMap() {
+ this.stableIdToTrackMap_ = {};
+ }
+
+ ContainerToTrackMap.prototype = {
+ addContainer(container, track) {
+ if (!track) {
+ throw new Error('Must provide a track.');
+ }
+ this.stableIdToTrackMap_[container.stableId] = track;
+ },
+
+ clear() {
+ this.stableIdToTrackMap_ = {};
+ },
+
+ getTrackByStableId(stableId) {
+ return this.stableIdToTrackMap_[stableId];
+ }
+ };
+
+ return {
+ ContainerToTrackMap,
+ };
+});
+</script>