1<!DOCTYPE html> 2<!-- 3Copyright (c) 2013 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/analysis_sub_view.html"> 10<link rel="import" href="/tracing/ui/analysis/multi_event_sub_view.html"> 11<link rel="import" href="/tracing/ui/analysis/related_events.html"> 12 13<polymer-element name="tr-ui-a-multi-async-slice-sub-view" 14 extends="tr-ui-a-sub-view"> 15 <template> 16 <style> 17 :host { 18 display: flex; 19 } 20 #container { 21 display: flex; 22 flex: 1 1 auto; 23 } 24 #events { 25 margin-left: 8px; 26 flex: 0 1 200px; 27 } 28 </style> 29 <div id="container"> 30 <tr-ui-a-multi-event-sub-view id="content"></tr-ui-a-multi-event-sub-view> 31 <div id="events"> 32 <tr-ui-a-related-events id="relatedEvents"></tr-ui-a-related-events> 33 </div> 34 </div> 35 </template> 36 37 <script> 38 'use strict'; 39 40 Polymer({ 41 get selection() { 42 return this.$.content.selection; 43 }, 44 45 set selection(selection) { 46 this.$.content.selection = selection; 47 this.$.relatedEvents.setRelatedEvents(selection); 48 if (this.$.relatedEvents.hasRelatedEvents()) { 49 this.$.relatedEvents.style.display = ''; 50 } else { 51 this.$.relatedEvents.style.display = 'none'; 52 } 53 }, 54 55 get relatedEventsToHighlight() { 56 if (!this.$.content.selection) 57 return undefined; 58 var selection = new tr.model.EventSet(); 59 this.$.content.selection.forEach(function(asyncEvent) { 60 if (!asyncEvent.associatedEvents) 61 return; 62 asyncEvent.associatedEvents.forEach(function(event) { 63 selection.push(event); 64 }); 65 }); 66 if (selection.length) 67 return selection; 68 return undefined; 69 } 70 }); 71 </script> 72</polymer-element> 73