OLD | NEW |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 * Create a visualization for |diagnostic|. | 60 * Create a visualization for |diagnostic|. |
61 * | 61 * |
62 * @param {!tr.v.d.Diagnostic} diagnostic | 62 * @param {!tr.v.d.Diagnostic} diagnostic |
63 * @param {string} name | 63 * @param {string} name |
64 * @param {!tr.v.Histogram} histogram | 64 * @param {!tr.v.Histogram} histogram |
65 * @return {Element} | 65 * @return {Element} |
66 */ | 66 */ |
67 function createDiagnosticSpan(diagnostic, name, histogram) { | 67 function createDiagnosticSpan(diagnostic, name, histogram) { |
68 const tagName = findElementNameForDiagnostic(diagnostic); | 68 const tagName = findElementNameForDiagnostic(diagnostic); |
69 const span = document.createElement(tagName); | 69 const span = document.createElement(tagName); |
70 if (span.build === undefined) throw new Error(tagName); | 70 if (span.build === undefined) { |
| 71 throw new Error(`Invalid diagnostic span "${tagName}"`); |
| 72 } |
71 span.build(diagnostic, name, histogram); | 73 span.build(diagnostic, name, histogram); |
72 return span; | 74 return span; |
73 } | 75 } |
74 | 76 |
75 return { | 77 return { |
76 createDiagnosticSpan, | 78 createDiagnosticSpan, |
77 }; | 79 }; |
78 }); | 80 }); |
79 </script> | 81 </script> |
OLD | NEW |