Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 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/base.html"> | 8 <link rel="import" href="/tracing/base/base.html"> |
| 9 | 9 |
| 10 <script> | 10 <script> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 | 46 |
| 47 if (object.__proto__ != Object.prototype) | 47 if (object.__proto__ != Object.prototype) |
| 48 throw new Error('Can only clone simple types'); | 48 throw new Error('Can only clone simple types'); |
| 49 var res = {}; | 49 var res = {}; |
| 50 for (var key in object) { | 50 for (var key in object) { |
| 51 res[key] = deepCopy(object[key]); | 51 res[key] = deepCopy(object[key]); |
| 52 } | 52 } |
| 53 return res; | 53 return res; |
| 54 } | 54 } |
| 55 | 55 |
| 56 function flattenArray(array_of_arrays) { | |
| 57 return [].concat.apply([], array_of_arrays); | |
|
nduca
2015/09/21 19:55:16
Array.prototype.concat
nednguyen
2015/09/21 20:09:54
Done.
| |
| 58 } | |
| 59 | |
| 56 function normalizeException(e) { | 60 function normalizeException(e) { |
| 57 if (e === undefined || e === null) { | 61 if (e === undefined || e === null) { |
| 58 return { | 62 return { |
| 59 typeName: 'UndefinedError', | 63 typeName: 'UndefinedError', |
| 60 message: 'Unknown: null or undefined exception', | 64 message: 'Unknown: null or undefined exception', |
| 61 stack: 'Unknown' | 65 stack: 'Unknown' |
| 62 }; | 66 }; |
| 63 } | 67 } |
| 64 | 68 |
| 65 if (typeof(e) == 'string') { | 69 if (typeof(e) == 'string') { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 return undefined; | 117 return undefined; |
| 114 } | 118 } |
| 115 } | 119 } |
| 116 return undefined; | 120 return undefined; |
| 117 } | 121 } |
| 118 | 122 |
| 119 return { | 123 return { |
| 120 addSingletonGetter: addSingletonGetter, | 124 addSingletonGetter: addSingletonGetter, |
| 121 | 125 |
| 122 deepCopy: deepCopy, | 126 deepCopy: deepCopy, |
| 127 flattenArray: flattenArray, | |
| 123 | 128 |
| 124 normalizeException: normalizeException, | 129 normalizeException: normalizeException, |
| 125 stackTrace: stackTrace, | 130 stackTrace: stackTrace, |
| 126 stackTraceAsString: stackTraceAsString, | 131 stackTraceAsString: stackTraceAsString, |
| 127 | 132 |
| 128 getUsingPath: getUsingPath | 133 getUsingPath: getUsingPath |
| 129 }; | 134 }; |
| 130 }); | 135 }); |
| 131 </script> | 136 </script> |
| OLD | NEW |