OLD | NEW |
1 /* | 1 /* |
2 Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
4 found in the LICENSE file. | 4 found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /* | 7 /* |
8 Common methods for performance-plotting JS. | 8 Common methods for performance-plotting JS. |
9 */ | 9 */ |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 if ('rev' in result) { | 79 if ('rev' in result) { |
80 result['rev'] = parseInt(result['rev']); | 80 result['rev'] = parseInt(result['rev']); |
81 result['rev'] = Math.max(result['rev'], -1); | 81 result['rev'] = Math.max(result['rev'], -1); |
82 } | 82 } |
83 return result; | 83 return result; |
84 } | 84 } |
85 | 85 |
86 // Creates the URL constructed from the current pathname and the given params. | 86 // Creates the URL constructed from the current pathname and the given params. |
87 function MakeURL(params) { | 87 function MakeURL(params) { |
88 var url = window.location.pathname; | 88 var arr = []; |
89 var sep = '?'; | 89 for (var p in params) { |
90 for (p in params) { | 90 if (typeof params[p] == 'object') { |
91 if (!p) | 91 // Repeated params, stored as hash like {valueA: 1, valueB: 1} |
92 continue; | 92 for (var r in params[p]) { |
93 url = url + sep + p + '=' + params[p]; | 93 arr.push(p + '=' + r); |
94 sep = '&'; | 94 } |
| 95 } else { |
| 96 arr.push(p + '=' + params[p]); |
| 97 } |
95 } | 98 } |
96 return url; | 99 return window.location.pathname + '?' + arr.join('&'); |
97 } | 100 } |
98 | 101 |
99 // Returns a string describing an object, recursively. On the initial call, | 102 // Returns a string describing an object, recursively. On the initial call, |
100 // |name| is optionally the name of the object and |indent| is not needed. | 103 // |name| is optionally the name of the object and |indent| is not needed. |
101 function DebugDump(obj, opt_name, opt_indent) { | 104 function DebugDump(obj, opt_name, opt_indent) { |
102 var name = opt_name || ''; | 105 var name = opt_name || ''; |
103 var indent = opt_indent || ''; | 106 var indent = opt_indent || ''; |
104 if (typeof obj == "object") { | 107 if (typeof obj == "object") { |
105 var child = null; | 108 var child = null; |
106 var output = indent + name + "\n"; | 109 var output = indent + name + "\n"; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 console.log(error) | 154 console.log(error) |
152 data = null; | 155 data = null; |
153 } | 156 } |
154 this.fetchCount_--; | 157 this.fetchCount_--; |
155 this.data_[i] = data; | 158 this.data_[i] = data; |
156 if (this.fetchCount_ == 0) { | 159 if (this.fetchCount_ == 0) { |
157 this.callbackArgs_.unshift(this.data_); | 160 this.callbackArgs_.unshift(this.data_); |
158 this.callback_.apply(this, this.callbackArgs_); | 161 this.callback_.apply(this, this.callbackArgs_); |
159 } | 162 } |
160 } | 163 } |
OLD | NEW |