1<!DOCTYPE html>
2<!--
3Copyright (c) 2015 The Chromium Authors. All rights reserved.
4Use of this source code is governed by a BSD-style license that can be
5found in the LICENSE file.
6-->
7
8<link rel="import" href="/tracing/model/event_set.html">
9<link rel="import" href="/tracing/ui/analysis/multi_event_sub_view.html">
10<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
11
12<polymer-element name="tr-ui-a-multi-frame-sub-view"
13    extends="tr-ui-a-sub-view">
14  <script>
15  'use strict';
16
17  Polymer({
18    created: function() {
19      this.currentSelection_ = undefined;
20    },
21
22    set selection(selection) {
23      this.textContent = '';
24      var realView = document.createElement('tr-ui-a-multi-event-sub-view');
25      realView.eventsHaveDuration = false;
26      realView.eventsHaveSubRows = false;
27
28      this.appendChild(realView);
29      realView.setSelectionWithoutErrorChecks(selection);
30
31      this.currentSelection_ = selection;
32    },
33
34    get selection() {
35      return this.currentSelection_;
36    },
37
38    get relatedEventsToHighlight() {
39      if (!this.currentSelection_)
40        return undefined;
41      var selection = new tr.model.EventSet();
42      this.currentSelection_.forEach(function(frameEvent) {
43        frameEvent.associatedEvents.forEach(function(event) {
44          selection.push(event);
45        });
46      });
47      return selection;
48    }
49  });
50  </script>
51</polymer-element>
52