Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: tracing/tracing/value/ui/unmergeable_diagnostic_set_span.html

Issue 3002973002: Refactor diagnostic spans to share a polymer behavior. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright 2017 The Chromium Authors. All rights reserved. 3 Copyright 2017 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <!-- 8 <!--
9 This file only depends on diagnostic_span.html, but it must be imported from 9 This file only depends on diagnostic_span.html, but it must be imported from
10 diagnostic_span.html. 10 diagnostic_span.html.
11 Fortunately, this file is only imported from diagnostic_span.html, so it can 11 Fortunately, this file is only imported from diagnostic_span.html, so it can
12 just not import anything. 12 just not import anything.
13 --> 13 -->
14 14
15 <link rel="import" href="/tracing/value/ui/diagnostic_span_behavior.html">
16
15 <dom-module id="tr-v-ui-unmergeable-diagnostic-set-span"> 17 <dom-module id="tr-v-ui-unmergeable-diagnostic-set-span">
16 <script> 18 </dom-module>
17 'use strict'; 19
20 <script>
21 'use strict';
22 tr.exportTo('tr.v.ui', function() {
18 Polymer({ 23 Polymer({
19 is: 'tr-v-ui-unmergeable-diagnostic-set-span', 24 is: 'tr-v-ui-unmergeable-diagnostic-set-span',
20 25 behaviors: [tr.v.ui.DIAGNOSTIC_SPAN_BEHAVIOR],
21 ready() {
22 this.diagnostic_ = undefined;
23 },
24
25 get diagnostic() {
26 return this.diagnostic_;
27 },
28
29 set diagnostic(d) {
30 this.diagnostic_ = d;
31 this.updateContents_();
32 },
33 26
34 updateContents_() { 27 updateContents_() {
35 Polymer.dom(this).textContent = ''; 28 Polymer.dom(this).textContent = '';
36 for (const diagnostic of this.diagnostic) { 29 for (const diagnostic of this.diagnostic) {
37 Polymer.dom(this).appendChild(tr.v.ui.createDiagnosticSpan(diagnostic)); 30 const div = document.createElement('div');
38 Polymer.dom(this).appendChild(document.createElement('br')); 31 div.appendChild(tr.v.ui.createDiagnosticSpan(
32 diagnostic, this.name_, this.histogram_));
33 Polymer.dom(this).appendChild(div);
39 } 34 }
40 } 35 }
41 }); 36 });
42 </script> 37
43 </dom-module> 38 return {};
39 });
40 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698