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

Side by Side Diff: tracing/tracing/value/ui/scalar_diagnostic_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 2016 The Chromium Authors. All rights reserved. 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 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 <link rel="import" href="/tracing/value/ui/diagnostic_span_behavior.html">
8 <link rel="import" href="/tracing/value/ui/scalar_span.html"> 9 <link rel="import" href="/tracing/value/ui/scalar_span.html">
9 10
10 <dom-module id="tr-v-ui-scalar-diagnostic-span"> 11 <dom-module id="tr-v-ui-scalar-diagnostic-span">
11 <template> 12 <template>
12 <tr-v-ui-scalar-span id="scalar"></tr-v-ui-scalar-span> 13 <tr-v-ui-scalar-span id="scalar"></tr-v-ui-scalar-span>
13 </template> 14 </template>
15 </dom-module>
14 16
15 <script> 17 <script>
16 'use strict'; 18 'use strict';
19 tr.exportTo('tr.v.ui', function() {
17 Polymer({ 20 Polymer({
18 is: 'tr-v-ui-scalar-diagnostic-span', 21 is: 'tr-v-ui-scalar-diagnostic-span',
19 22 behaviors: [tr.v.ui.DIAGNOSTIC_SPAN_BEHAVIOR],
20 ready() {
21 this.diagnostic_ = undefined;
22 },
23
24 get diagnostic() {
25 return this.diagnostic_;
26 },
27
28 set diagnostic(d) {
29 this.diagnostic_ = d;
30 this.updateContents_();
31 },
32 23
33 updateContents_() { 24 updateContents_() {
34 this.$.scalar.setValueAndUnit(this.diagnostic.value.value, 25 this.$.scalar.setValueAndUnit(this.diagnostic.value.value,
35 this.diagnostic.value.unit); 26 this.diagnostic.value.unit);
36 } 27 }
37 }); 28 });
38 </script> 29
39 </dom-module> 30 return {};
31 });
32 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698