| 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/value/numeric.html"> | 9 <link rel="import" href="/tracing/value/numeric.html"> |
| 10 <link rel="import" href="/tracing/value/unit.html"> | 10 <link rel="import" href="/tracing/value/unit.html"> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 }, this); | 64 }, this); |
| 65 }, | 65 }, |
| 66 | 66 |
| 67 getValuesWithName: function(name) { | 67 getValuesWithName: function(name) { |
| 68 return tr.b.dictionaryValues(this.values_).filter(function(value) { | 68 return tr.b.dictionaryValues(this.values_).filter(function(value) { |
| 69 return value.name.indexOf(name) > -1; | 69 return value.name.indexOf(name) > -1; |
| 70 }); | 70 }); |
| 71 }, | 71 }, |
| 72 | 72 |
| 73 addValue: function(v) { | 73 addValue: function(v) { |
| 74 if (!(v instanceof tr.v.NumericValue)) { | |
| 75 var err = new Error('Tried to add value ' + v + | |
| 76 ' which is non-Numeric'); | |
| 77 err.name = 'ValueError'; | |
| 78 throw err; | |
| 79 } | |
| 80 | |
| 81 if (this.values_[v.guid]) { | 74 if (this.values_[v.guid]) { |
| 82 var err = new Error('Tried to add same value twice'); | 75 var err = new Error('Tried to add same value twice'); |
| 83 err.name = 'ValueError'; | 76 err.name = 'ValueError'; |
| 84 throw err; | 77 throw err; |
| 85 } | 78 } |
| 86 | 79 |
| 87 this.values_[v.guid] = v; | 80 this.values_[v.guid] = v; |
| 88 | 81 |
| 89 if (v.numeric instanceof tr.v.Numeric) { | 82 if (v.numeric instanceof tr.v.Numeric) { |
| 90 ValueSet.computeSummaryValuesForNumericValue(v).forEach(function(s) { | 83 ValueSet.computeSummaryValuesForNumericValue(v).forEach(function(s) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 104 value.name + '_' + stat.name, stat.scalar, | 97 value.name + '_' + stat.name, stat.scalar, |
| 105 { description: value.description }); | 98 { description: value.description }); |
| 106 }); | 99 }); |
| 107 }; | 100 }; |
| 108 | 101 |
| 109 return { | 102 return { |
| 110 ValueSet: ValueSet | 103 ValueSet: ValueSet |
| 111 }; | 104 }; |
| 112 }); | 105 }); |
| 113 </script> | 106 </script> |
| OLD | NEW |