Home | History | Annotate | Download | only in analysis
      1 <!DOCTYPE html>
      2 <!--
      3 Copyright (c) 2014 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 <link rel="import" href="/ui/base/table.html">
      8 
      9 <polymer-element name="tr-ui-a-stack-frame">
     10   <template>
     11     <style>
     12     :host {
     13       display: flex;
     14       flex-direction: row;
     15       align-items: center;
     16     }
     17     </style>
     18     <tr-ui-b-table id="table"></tr-ui-b-table>
     19   </template>
     20   <script>
     21   'use strict';
     22 
     23   Polymer({
     24     ready: function() {
     25       this.stackFrame_ = undefined;
     26       this.$.table.tableColumns = [];
     27       this.$.table.showHeader = false;
     28     },
     29 
     30     get stackFrame() {
     31       return this.stackFrame_;
     32     },
     33 
     34     set stackFrame(stackFrame) {
     35       var table = this.$.table;
     36 
     37       this.stackFrame_ = stackFrame;
     38       if (stackFrame === undefined) {
     39         table.tableColumns = [];
     40         table.tableRows = [];
     41         table.rebuild();
     42         return;
     43       }
     44 
     45       var hasCategory = false;
     46       var hasName = false;
     47       var hasTitle = false;
     48 
     49       table.tableRows = stackFrame.stackTrace;
     50       table.tableRows.forEach(function(row) {
     51         hasCategory |= row.category !== undefined;
     52         hasName |= row.name !== undefined;
     53         hasTitle |= row.title !== undefined;
     54       });
     55 
     56       var cols = [];
     57       if (hasCategory)
     58         cols.push({
     59           title: 'Category',
     60           value: function(row) { return row.category; }
     61         });
     62 
     63       if (hasName)
     64         cols.push({
     65           title: 'Name',
     66           value: function(row) { return row.name; }
     67         });
     68 
     69       if (hasTitle)
     70         cols.push({
     71           title: 'Title',
     72           value: function(row) { return row.title; }
     73         });
     74 
     75       table.tableColumns = cols;
     76       table.rebuild();
     77     }
     78   });
     79   </script>
     80 </polymer-element>
     81