Chris Craik | b122baf | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <!-- |
| 3 | Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 4 | Use of this source code is governed by a BSD-style license that can be |
| 5 | found in the LICENSE file. |
| 6 | --> |
| 7 | |
| 8 | <link rel="import" href="/core/analysis/analysis_sub_view.html"> |
Chris Craik | beca7ae | 2015-04-07 13:29:55 -0700 | [diff] [blame] | 9 | <link rel="import" href="/core/analysis/table_builder.html"> |
| 10 | <link rel="import" href="/core/analysis/stack_frame.html"> |
| 11 | <link rel="import" href="/core/analysis/time_stamp.html"> |
Chris Craik | b122baf | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 12 | |
| 13 | <polymer-element name="tv-c-single-sample-sub-view" |
| 14 | extends="tracing-analysis-sub-view"> |
Chris Craik | beca7ae | 2015-04-07 13:29:55 -0700 | [diff] [blame] | 15 | <template> |
| 16 | <style> |
| 17 | :host { |
| 18 | display: flex; |
| 19 | } |
| 20 | </style> |
| 21 | <tracing-analysis-nested-table id="content"></tracing-analysis-nested-table> |
| 22 | </template> |
Chris Craik | b122baf | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 23 | <script> |
| 24 | 'use strict'; |
| 25 | |
| 26 | Polymer({ |
| 27 | created: function() { |
| 28 | this.currentSelection_ = undefined; |
| 29 | }, |
| 30 | |
Chris Craik | beca7ae | 2015-04-07 13:29:55 -0700 | [diff] [blame] | 31 | ready: function() { |
| 32 | this.$.content.tableColumns = [ |
| 33 | { |
| 34 | title: 'FirstColumn', |
| 35 | value: function(row) { return row.title; }, |
| 36 | width: '250px' |
| 37 | }, |
| 38 | { |
| 39 | title: 'SecondColumn', |
| 40 | value: function(row) { return row.value; }, |
| 41 | width: '100%' |
| 42 | } |
| 43 | ]; |
| 44 | this.$.content.showHeader = false; |
Chris Craik | b122baf | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 45 | }, |
| 46 | |
| 47 | get selection() { |
| 48 | return this.currentSelection_; |
| 49 | }, |
| 50 | |
Chris Craik | beca7ae | 2015-04-07 13:29:55 -0700 | [diff] [blame] | 51 | set selection(selection) { |
| 52 | this.currentSelection_ = selection; |
Chris Craik | b122baf | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 53 | |
Chris Craik | beca7ae | 2015-04-07 13:29:55 -0700 | [diff] [blame] | 54 | if (this.currentSelection_ === undefined) { |
| 55 | this.$.content.tableRows = []; |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | var sample = this.currentSelection_[0]; |
| 60 | var table = this.$.content; |
| 61 | |
| 62 | var rows = []; |
| 63 | |
| 64 | rows.push({ |
| 65 | title: 'Title', |
| 66 | value: sample.title |
| 67 | }); |
| 68 | |
| 69 | rows.push({ |
| 70 | title: 'Sample time', |
| 71 | value: tv.c.analysis.createTimeStamp(sample.start) |
| 72 | }); |
| 73 | |
| 74 | var sfEl = document.createElement('tv-c-a-stack-frame'); |
| 75 | sfEl.stackFrame = sample.leafStackFrame; |
| 76 | rows.push({ |
| 77 | title: 'Stack trace', |
| 78 | value: sfEl |
| 79 | }); |
| 80 | table.tableRows = rows; |
| 81 | table.rebuild(); |
Chris Craik | b122baf | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 82 | } |
| 83 | }); |
| 84 | </script> |
Chris Craik | 44c2820 | 2015-05-12 17:25:16 -0700 | [diff] [blame^] | 85 | </polymer-element> |