OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2015 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/guid.html"> | 8 <link rel="import" href="/tracing/base/guid.html"> |
9 <link rel="import" href="/tracing/base/iteration_helpers.html"> | 9 <link rel="import" href="/tracing/base/iteration_helpers.html"> |
10 <link rel="import" href="/tracing/base/utils.html"> | 10 <link rel="import" href="/tracing/base/utils.html"> |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 if (d.numeric === undefined) | 119 if (d.numeric === undefined) |
120 throw new Error('Expected numeric to be provided'); | 120 throw new Error('Expected numeric to be provided'); |
121 var numeric = tr.v.NumericBase.fromDict(d.numeric); | 121 var numeric = tr.v.NumericBase.fromDict(d.numeric); |
122 var value = new NumericValue(d.name, numeric, d); | 122 var value = new NumericValue(d.name, numeric, d); |
123 return value; | 123 return value; |
124 }; | 124 }; |
125 | 125 |
126 NumericValue.prototype = { | 126 NumericValue.prototype = { |
127 __proto__: Value.prototype, | 127 __proto__: Value.prototype, |
128 | 128 |
| 129 merge: function(other) { |
| 130 if (!(other instanceof NumericValue)) |
| 131 throw new Error('Merging non-NumericValues is not supported'); |
| 132 |
| 133 var numeric = this.numeric.merge(other.numeric); |
| 134 var result = new NumericValue(this.name, numeric); |
| 135 // TODO(eakuefner): merge diagnostics? |
| 136 return result; |
| 137 }, |
| 138 |
129 asDictInto_: function(d) { | 139 asDictInto_: function(d) { |
130 d.type = 'numeric'; | 140 d.type = 'numeric'; |
131 d.numeric = this.numeric.asDict(); | 141 d.numeric = this.numeric.asDict(); |
132 } | 142 } |
133 }; | 143 }; |
134 | 144 |
135 /** @constructor */ | 145 /** @constructor */ |
136 function DictValue(name, value, opt_options) { | 146 function DictValue(name, value, opt_options) { |
137 Value.call(this, name, opt_options); | 147 Value.call(this, name, opt_options); |
138 this.value = value; | 148 this.value = value; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 233 |
224 return { | 234 return { |
225 Value: Value, | 235 Value: Value, |
226 NumericValue: NumericValue, | 236 NumericValue: NumericValue, |
227 DictValue: DictValue, | 237 DictValue: DictValue, |
228 FailureValue: FailureValue, | 238 FailureValue: FailureValue, |
229 SkipValue: SkipValue | 239 SkipValue: SkipValue |
230 }; | 240 }; |
231 }); | 241 }); |
232 </script> | 242 </script> |
OLD | NEW |