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/ui/analysis/analysis_sub_view.html"> 9<link rel="import" href="/tracing/ui/analysis/stack_frame.html"> 10<link rel="import" href="/tracing/ui/base/table.html"> 11<link rel="import" href="/tracing/value/ui/scalar_span.html"> 12<link rel="import" href="/tracing/value/unit.html"> 13 14<polymer-element name="tr-ui-a-single-sample-sub-view" 15 extends="tr-ui-a-sub-view"> 16 <template> 17 <style> 18 :host { 19 display: flex; 20 } 21 </style> 22 <tr-ui-b-table id="content"></tr-ui-b-table> 23 </template> 24 <script> 25 'use strict'; 26 27 Polymer({ 28 created: function() { 29 this.currentSelection_ = undefined; 30 }, 31 32 ready: function() { 33 this.$.content.tableColumns = [ 34 { 35 title: 'FirstColumn', 36 value: function(row) { return row.title; }, 37 width: '250px' 38 }, 39 { 40 title: 'SecondColumn', 41 value: function(row) { return row.value; }, 42 width: '100%' 43 } 44 ]; 45 this.$.content.showHeader = false; 46 }, 47 48 get selection() { 49 return this.currentSelection_; 50 }, 51 52 set selection(selection) { 53 this.currentSelection_ = selection; 54 55 if (this.currentSelection_ === undefined) { 56 this.$.content.tableRows = []; 57 return; 58 } 59 60 var sample = this.currentSelection_[0]; 61 var table = this.$.content; 62 63 var rows = []; 64 65 rows.push({ 66 title: 'Title', 67 value: sample.title 68 }); 69 70 rows.push({ 71 title: 'Sample time', 72 value: tr.v.ui.createScalarSpan(sample.start, { 73 unit: tr.v.Unit.byName.timeStampInMs, 74 ownerDocument: this.ownerDocument 75 }) 76 }); 77 78 var sfEl = document.createElement('tr-ui-a-stack-frame'); 79 sfEl.stackFrame = sample.leafStackFrame; 80 rows.push({ 81 title: 'Stack trace', 82 value: sfEl 83 }); 84 table.tableRows = rows; 85 table.rebuild(); 86 } 87 }); 88 </script> 89</polymer-element> 90