| <!DOCTYPE html> |
| <!-- |
| Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| |
| <link rel="import" href="/base/ui/dom_helpers.html"> |
| <link rel="import" href="/core/analysis/table_builder.html"> |
| <link rel="import" href="/core/analysis/time_stamp.html"> |
| <link rel="import" href="/core/analysis/analysis_link.html"> |
| <link rel="import" href="/core/analysis/analysis_sub_view.html"> |
| <link rel="import" href="/core/analysis/util.html"> |
| |
| <polymer-element name="tv-c-multi-object-sub-view" |
| extends="tracing-analysis-sub-view"> |
| <template> |
| <style> |
| :host { |
| display: flex; |
| } |
| </style> |
| <tracing-analysis-nested-table id="content"></tracing-analysis-nested-table> |
| </template> |
| <script> |
| 'use strict'; |
| |
| Polymer({ |
| created: function() { |
| this.currentSelection_ = undefined; |
| }, |
| |
| ready: function() { |
| this.$.content.showHeader = false; |
| }, |
| |
| get selection() { |
| return this.currentSelection_; |
| }, |
| |
| set selection(selection) { |
| this.currentSelection_ = selection; |
| |
| var objectEvents = tv.b.asArray(selection).sort( |
| tv.b.Range.compareByMinTimes); |
| |
| var table = this.$.content; |
| table.tableColumns = [ |
| { |
| title: 'First', |
| value: function(event) { |
| if (event instanceof tv.c.trace_model.ObjectSnapshot) |
| return tv.c.analysis.createTimeStamp(event.ts); |
| |
| var spanEl = document.createElement('span'); |
| spanEl.appendChild(tv.c.analysis.createTimeStamp(event.creationTs)); |
| spanEl.appendChild(tv.b.ui.createSpan({ |
| textContent: '-', |
| marginLeft: '4px', |
| marginRight: '4px' |
| })); |
| if (event.deletionTs != Number.MAX_VALUE) { |
| spanEl.appendChild( |
| tv.c.analysis.createTimeStamp(event.deletionTs)); |
| } |
| return spanEl; |
| }, |
| width: '200px' |
| }, |
| { |
| title: 'Second', |
| value: function(event) { |
| var linkEl = document.createElement('tv-c-analysis-link'); |
| linkEl.setSelectionAndContent(function() { |
| return new tv.c.Selection(event); |
| }, event.userFriendlyName); |
| return linkEl; |
| }, |
| width: '100%' |
| } |
| ]; |
| table.tableRows = objectEvents; |
| table.rebuild(); |
| } |
| }); |
| </script> |
| </polymer-element> |