| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 var object = self; | 557 var object = self; |
| 558 for (var i = 0; object && (i < path.length); ++i) | 558 for (var i = 0; object && (i < path.length); ++i) |
| 559 object = object[path[i]]; | 559 object = object[path[i]]; |
| 560 if (object) | 560 if (object) |
| 561 this._cachedTypeClasses[typeName] = /** @type function(new:Object) */ (o
bject); | 561 this._cachedTypeClasses[typeName] = /** @type function(new:Object) */ (o
bject); |
| 562 } | 562 } |
| 563 return this._cachedTypeClasses[typeName] || null; | 563 return this._cachedTypeClasses[typeName] || null; |
| 564 } | 564 } |
| 565 | 565 |
| 566 /** | 566 /** |
| 567 * @param {!Function} constructorFunction | 567 * @template T |
| 568 * @return {!Object} | 568 * @param {function(new:T, ...)} constructorFunction |
| 569 * @return {!T} |
| 569 */ | 570 */ |
| 570 sharedInstance(constructorFunction) { | 571 sharedInstance(constructorFunction) { |
| 571 if (Runtime._instanceSymbol in constructorFunction) | 572 return singleton(constructorFunction); |
| 572 return constructorFunction[Runtime._instanceSymbol]; | |
| 573 var instance = new constructorFunction(); | |
| 574 constructorFunction[Runtime._instanceSymbol] = instance; | |
| 575 return instance; | |
| 576 } | 573 } |
| 577 } | 574 }; |
| 578 | |
| 579 ; | |
| 580 | 575 |
| 581 | 576 |
| 582 /** | 577 /** |
| 583 * @type {!Object.<string, string>} | 578 * @type {!Object.<string, string>} |
| 584 */ | 579 */ |
| 585 Runtime._queryParamsObject = { | 580 Runtime._queryParamsObject = { |
| 586 __proto__: null | 581 __proto__: null |
| 587 }; | 582 }; |
| 588 | 583 |
| 589 Runtime._instanceSymbol = Symbol('instance'); | 584 Runtime._instanceSymbol = Symbol('instance'); |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 send(message) {}, | 1120 send(message) {}, |
| 1126 | 1121 |
| 1127 /** | 1122 /** |
| 1128 * @return {!Promise<boolean>} | 1123 * @return {!Promise<boolean>} |
| 1129 */ | 1124 */ |
| 1130 close() {} | 1125 close() {} |
| 1131 }; | 1126 }; |
| 1132 | 1127 |
| 1133 /** @type {!Runtime} */ | 1128 /** @type {!Runtime} */ |
| 1134 var runtime; | 1129 var runtime; |
| OLD | NEW |