Chris Craik | b122baf | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <!-- |
| 3 | Copyright (c) 2015 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 | |
Chris Craik | b122baf | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 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"> |
Chris Craik | b122baf | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 10 | <link rel="import" href="/core/analysis/util.html"> |
| 11 | |
| 12 | <polymer-element name="tv-c-multi-global-memory-dump-sub-view" |
| 13 | extends="tracing-analysis-sub-view"> |
Chris Craik | beca7ae | 2015-04-07 13:29:55 -0700 | [diff] [blame^] | 14 | <template> |
| 15 | <style> |
| 16 | :host { |
| 17 | display: flex; |
| 18 | } |
| 19 | </style> |
| 20 | <tracing-analysis-nested-table id="content"></tracing-analysis-nested-table> |
| 21 | </template> |
| 22 | |
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 | get selection() { |
| 32 | return this.currentSelection_; |
| 33 | }, |
| 34 | |
Chris Craik | b122baf | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 35 | set selection(selection) { |
| 36 | this.currentSelection_ = selection; |
Chris Craik | b122baf | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 37 | |
| 38 | selection = tv.b.asArray(selection).sort( |
| 39 | tv.b.Range.compareByMinTimes); |
| 40 | |
Chris Craik | beca7ae | 2015-04-07 13:29:55 -0700 | [diff] [blame^] | 41 | var table = this.$.content; |
| 42 | table.tableColumns = [ |
| 43 | { |
| 44 | title: 'Dump', |
| 45 | value: function(row) { |
| 46 | var linkEl = document.createElement('tv-c-analysis-link'); |
| 47 | linkEl.setSelectionAndContent(function() { |
| 48 | return new tv.c.Selection(row); |
| 49 | }); |
| 50 | var spanEl = document.createElement('span'); |
| 51 | spanEl.textContent = 'Memory dump at '; |
| 52 | linkEl.appendChild(spanEl); |
| 53 | linkEl.appendChild(tv.c.analysis.createTimeStamp(row.start)); |
| 54 | return linkEl; |
| 55 | } |
Chris Craik | b122baf | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 56 | } |
Chris Craik | beca7ae | 2015-04-07 13:29:55 -0700 | [diff] [blame^] | 57 | ]; |
| 58 | table.showHeader = false; |
| 59 | table.tableRows = selection.map(function(dump) { |
| 60 | return dump; |
Chris Craik | b122baf | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 61 | }); |
Chris Craik | beca7ae | 2015-04-07 13:29:55 -0700 | [diff] [blame^] | 62 | table.rebuild(); |
Chris Craik | b122baf | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 63 | } |
| 64 | }); |
| 65 | </script> |
| 66 | </polymer> |