| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <!-- | |
| 3 Copyright 2016 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="/tracing/ui/base/table.html"> | |
| 9 | |
| 10 <dom-module id="tr-v-ui-revision-info-span"> | |
| 11 <template> | |
| 12 <tr-ui-b-table id="table"></tr-ui-b-table> | |
| 13 </template> | |
| 14 </dom-module> | |
| 15 <script> | |
| 16 'use strict'; | |
| 17 tr.exportTo('tr.v.ui', function() { | |
| 18 const CHROMIUM_REVISION_HOST = 'https://chromium.googlesource.com/chromium/src
/'; | |
| 19 const V8_REVISION_HOST = 'https://chromium.googlesource.com/v8/v8.git/'; | |
| 20 const CATAPULT_REVISION_HOST = 'https://chromium.googlesource.com/external/git
hub.com/catapult-project/catapult.git/'; | |
| 21 const ANGLE_REVISION_HOST = 'https://chromium.googlesource.com/angle/angle/'; | |
| 22 const SKIA_REVISION_HOST = 'https://chromium.googlesource.com/skia/'; | |
| 23 const WEBRTC_REVISION_HOST = 'https://chromium.googlesource.com/external/webrt
c/'; | |
| 24 | |
| 25 Polymer({ | |
| 26 is: 'tr-v-ui-revision-info-span', | |
| 27 | |
| 28 ready() { | |
| 29 this.diagnostic_ = undefined; | |
| 30 this.$.table.showHeader = false; | |
| 31 this.$.table.tableColumns = [ | |
| 32 {value: row => row[0]}, | |
| 33 {value: row => row[1]}, | |
| 34 ]; | |
| 35 }, | |
| 36 | |
| 37 get diagnostic() { | |
| 38 return this.diagnostic_; | |
| 39 }, | |
| 40 | |
| 41 set diagnostic(d) { | |
| 42 this.diagnostic_ = d; | |
| 43 this.updateContents_(); | |
| 44 }, | |
| 45 | |
| 46 buildRow_(rows, label, revisions, host) { | |
| 47 if (revisions.length === 0) return; | |
| 48 | |
| 49 const anchor = document.createElement('a'); | |
| 50 anchor.innerText = revisions[0]; | |
| 51 | |
| 52 if (revisions.length === 1) { | |
| 53 anchor.href = host + '+/' + revisions[0]; | |
| 54 } else { | |
| 55 anchor.innerText += '..' + revisions[1]; | |
| 56 anchor.href = host + '+log/' + revisions[0] + '..' + revisions[1]; | |
| 57 } | |
| 58 | |
| 59 // Prevent the table from calling preventDefault(). | |
| 60 anchor.addEventListener('click', event => { | |
| 61 event.stopPropagation(); | |
| 62 }); | |
| 63 | |
| 64 rows.push([label, anchor]); | |
| 65 }, | |
| 66 | |
| 67 updateContents_() { | |
| 68 if (this.diagnostic === undefined) { | |
| 69 this.$.table.tableRows = []; | |
| 70 return; | |
| 71 } | |
| 72 | |
| 73 const rows = []; | |
| 74 if (this.diagnostic.chromiumCommitPosition) { | |
| 75 rows.push([ | |
| 76 'chromiumCommitPosition', this.diagnostic.chromiumCommitPosition]); | |
| 77 } | |
| 78 if (this.diagnostic.v8CommitPosition) { | |
| 79 rows.push(['v8CommitPosition', this.diagnostic.v8CommitPosition]); | |
| 80 } | |
| 81 this.buildRow_( | |
| 82 rows, 'chromium', this.diagnostic.chromium, CHROMIUM_REVISION_HOST); | |
| 83 this.buildRow_(rows, 'v8', this.diagnostic.v8, V8_REVISION_HOST); | |
| 84 this.buildRow_( | |
| 85 rows, 'catapult', this.diagnostic.catapult, CATAPULT_REVISION_HOST); | |
| 86 this.buildRow_(rows, 'angle', this.diagnostic.angle, ANGLE_REVISION_HOST); | |
| 87 this.buildRow_(rows, 'skia', this.diagnostic.skia, SKIA_REVISION_HOST); | |
| 88 this.buildRow_( | |
| 89 rows, 'webrtc', this.diagnostic.webrtc, WEBRTC_REVISION_HOST); | |
| 90 | |
| 91 this.$.table.tableRows = rows; | |
| 92 } | |
| 93 }); | |
| 94 | |
| 95 return { | |
| 96 CHROMIUM_REVISION_HOST, | |
| 97 V8_REVISION_HOST, | |
| 98 CATAPULT_REVISION_HOST, | |
| 99 ANGLE_REVISION_HOST, | |
| 100 SKIA_REVISION_HOST, | |
| 101 WEBRTC_REVISION_HOST, | |
| 102 }; | |
| 103 }); | |
| 104 </script> | |
| OLD | NEW |