| 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/base/iteration_helpers.html"> | 8 <link rel="import" href="/tracing/base/iteration_helpers.html"> |
| 9 <link rel="import" href="/tracing/base/unit.html"> | 9 <link rel="import" href="/tracing/base/unit.html"> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 throw new Error('Not implemented'); | 36 throw new Error('Not implemented'); |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 | 39 |
| 40 class ScalarNumeric extends NumericBase { | 40 class ScalarNumeric extends NumericBase { |
| 41 constructor(unit, value) { | 41 constructor(unit, value) { |
| 42 if (!(unit instanceof tr.b.Unit)) | 42 if (!(unit instanceof tr.b.Unit)) |
| 43 throw new Error('Expected Unit'); | 43 throw new Error('Expected Unit'); |
| 44 | 44 |
| 45 if (!(typeof(value) == 'number')) | 45 if (!(typeof(value) === 'number')) |
| 46 throw new Error('Expected value to be number'); | 46 throw new Error('Expected value to be number'); |
| 47 | 47 |
| 48 super(unit); | 48 super(unit); |
| 49 this.value = value; | 49 this.value = value; |
| 50 } | 50 } |
| 51 | 51 |
| 52 asDictInto_(d) { | 52 asDictInto_(d) { |
| 53 d.type = 'scalar'; | 53 d.type = 'scalar'; |
| 54 | 54 |
| 55 // Infinity and NaN are left out of JSON for security reasons that do not | 55 // Infinity and NaN are left out of JSON for security reasons that do not |
| (...skipping 28 matching lines...) Expand all Loading... |
| 84 return new ScalarNumeric(tr.b.Unit.fromJSON(d.unit), d.value); | 84 return new ScalarNumeric(tr.b.Unit.fromJSON(d.unit), d.value); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 return { | 88 return { |
| 89 NumericBase: NumericBase, | 89 NumericBase: NumericBase, |
| 90 ScalarNumeric: ScalarNumeric | 90 ScalarNumeric: ScalarNumeric |
| 91 }; | 91 }; |
| 92 }); | 92 }); |
| 93 </script> | 93 </script> |
| OLD | NEW |