Chromium Code Reviews| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 url = window.location.pathname; |
| 89 var sep = '?'; | 89 var sep = '?'; |
| 90 for (p in params) { | 90 for (p in params) { |
| 91 if (!p) | 91 if (!p) |
| 92 continue; | 92 continue; |
| 93 url = url + sep + p + '=' + params[p]; | 93 var new_param = ''; |
|
tonyg
2012/10/16 18:28:29
nit: newParam
| |
| 94 if (typeof params[p] == "object") { | |
| 95 // Repeated param | |
| 96 var repeated = [] | |
|
tonyg
2012/10/16 18:28:29
nit: end with semicolon
| |
| 97 for (r in params[p]) { | |
| 98 repeated.push(r + '=' + params[p][r]); | |
| 99 } | |
| 100 new_param = repeated.join("&"); | |
| 101 } | |
| 102 else { | |
|
tonyg
2012/10/16 18:28:29
Bring this up a line
| |
| 103 new_param = p + '=' + params[p]; | |
| 104 } | |
| 105 url = url + sep + new_param; | |
| 94 sep = '&'; | 106 sep = '&'; |
| 95 } | 107 } |
| 96 return url; | 108 return url; |
| 97 } | 109 } |
| 98 | 110 |
| 99 // Returns a string describing an object, recursively. On the initial call, | 111 // 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. | 112 // |name| is optionally the name of the object and |indent| is not needed. |
| 101 function DebugDump(obj, opt_name, opt_indent) { | 113 function DebugDump(obj, opt_name, opt_indent) { |
| 102 var name = opt_name || ''; | 114 var name = opt_name || ''; |
| 103 var indent = opt_indent || ''; | 115 var indent = opt_indent || ''; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 console.log(error) | 163 console.log(error) |
| 152 data = null; | 164 data = null; |
| 153 } | 165 } |
| 154 this.fetchCount_--; | 166 this.fetchCount_--; |
| 155 this.data_[i] = data; | 167 this.data_[i] = data; |
| 156 if (this.fetchCount_ == 0) { | 168 if (this.fetchCount_ == 0) { |
| 157 this.callbackArgs_.unshift(this.data_); | 169 this.callbackArgs_.unshift(this.data_); |
| 158 this.callback_.apply(this, this.callbackArgs_); | 170 this.callback_.apply(this, this.callbackArgs_); |
| 159 } | 171 } |
| 160 } | 172 } |
| OLD | NEW |