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 | |
| 8 | <link rel="import" href="/core/analysis/analysis_sub_view.html"> |
| 9 | <link rel="import" href="/core/analysis/generic_object_view.html"> |
| 10 | |
| 11 | <polymer-element name="tv-c-single-global-memory-dump-sub-view" |
| 12 | extends="tracing-analysis-sub-view"> |
| 13 | <script> |
| 14 | 'use strict'; |
| 15 | |
| 16 | Polymer({ |
| 17 | created: function() { |
| 18 | this.currentSelection_ = undefined; |
| 19 | }, |
| 20 | |
| 21 | set selection(selection) { |
| 22 | if (selection.length !== 1) |
| 23 | throw new Error('Only supports a single global memory dump'); |
| 24 | if (!(selection[0] instanceof tv.c.trace_model.GlobalMemoryDump)) |
| 25 | throw new Error('Only supports global memory dumps'); |
| 26 | this.setSelectionWithoutErrorChecks(selection); |
| 27 | }, |
| 28 | |
| 29 | get selection() { |
| 30 | return this.currentSelection_; |
| 31 | }, |
| 32 | |
| 33 | setSelectionWithoutErrorChecks: function(selection) { |
| 34 | this.currentSelection_ = selection; |
| 35 | this.textContent = ''; |
| 36 | |
| 37 | var pidToProcessMemoryMap = {}; |
| 38 | var gd = this.currentSelection_[0]; |
| 39 | for (var pid in gd.processMemoryDumps) { |
| 40 | var pd = gd.processMemoryDumps[pid]; |
| 41 | pidToProcessMemoryMap[pid] = pd.args; |
| 42 | } |
| 43 | |
| 44 | var objectView = |
| 45 | document.createElement('tv-c-analysis-generic-object-view'); |
| 46 | objectView.object = pidToProcessMemoryMap; |
| 47 | this.appendChild(objectView); |
| 48 | } |
| 49 | }); |
| 50 | </script> |
| 51 | </polymer> |