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

Side by Side Diff: tracing/tracing/value/ui/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/ui/base/deep_utils.html"> 8 <link rel="import" href="/tracing/ui/base/deep_utils.html">
9 <link rel="import" href="/tracing/value/diagnostics/diagnostic.html"> 9 <link rel="import" href="/tracing/value/diagnostics/diagnostic.html">
10 <link rel="import" href="/tracing/value/ui/breakdown_span.html"> 10 <link rel="import" href="/tracing/value/ui/breakdown_span.html">
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 throw new Error('Element not registered: ' + tagName); 54 throw new Error('Element not registered: ' + tagName);
55 } 55 }
56 56
57 return tagName; 57 return tagName;
58 } 58 }
59 59
60 /** 60 /**
61 * Create a visualization for |diagnostic|. 61 * Create a visualization for |diagnostic|.
62 * 62 *
63 * @param {!tr.v.d.Diagnostic} diagnostic 63 * @param {!tr.v.d.Diagnostic} diagnostic
64 * @param {!tr.v.Histogram=} opt_histogram 64 * @param {string} name
65 * @param {!tr.v.Histogram} histogram
65 * @return {Element} 66 * @return {Element}
66 */ 67 */
67 function createDiagnosticSpan(diagnostic, opt_histogram) { 68 function createDiagnosticSpan(diagnostic, name, histogram) {
68 const tagName = findElementNameForDiagnostic(diagnostic); 69 const tagName = findElementNameForDiagnostic(diagnostic);
69 const span = document.createElement(tagName); 70 const span = document.createElement(tagName);
70 span.histogram = opt_histogram; 71 if (span.build === undefined) throw new Error(tagName);
71 span.diagnostic = diagnostic; 72 span.build(diagnostic, name, histogram);
72 return span; 73 return span;
73 } 74 }
74 75
75 return { 76 return {
76 createDiagnosticSpan, 77 createDiagnosticSpan,
77 }; 78 };
78 }); 79 });
79 </script> 80 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698