| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 this._cachedTypeClasses = {}; | 109 this._cachedTypeClasses = {}; |
| 110 | 110 |
| 111 /** | 111 /** |
| 112 * @type {!Object.<string, !Runtime.ModuleDescriptor>} | 112 * @type {!Object.<string, !Runtime.ModuleDescriptor>} |
| 113 */ | 113 */ |
| 114 this._descriptorsMap = {}; | 114 this._descriptorsMap = {}; |
| 115 for (var i = 0; i < descriptors.length; ++i) | 115 for (var i = 0; i < descriptors.length; ++i) |
| 116 this._descriptorsMap[descriptors[i]["name"]] = descriptors[i]; | 116 this._descriptorsMap[descriptors[i]["name"]] = descriptors[i]; |
| 117 } | 117 } |
| 118 | 118 |
| 119 /** |
| 120 * @param {string} moduleName |
| 121 * @return {!Worker} |
| 122 */ |
| 123 Runtime.startWorker = function(moduleName) |
| 124 { |
| 125 return new Worker(moduleName + "/_module.js"); |
| 126 } |
| 127 |
| 119 Runtime.prototype = { | 128 Runtime.prototype = { |
| 120 /** | 129 /** |
| 121 * @param {!Array.<string>} configuration | 130 * @param {!Array.<string>} configuration |
| 122 */ | 131 */ |
| 123 registerModules: function(configuration) | 132 registerModules: function(configuration) |
| 124 { | 133 { |
| 125 for (var i = 0; i < configuration.length; ++i) | 134 for (var i = 0; i < configuration.length; ++i) |
| 126 this.registerModule(configuration[i]); | 135 this.registerModule(configuration[i]); |
| 127 }, | 136 }, |
| 128 | 137 |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 Error.stackTraceLimit = 50; | 436 Error.stackTraceLimit = 50; |
| 428 console.assert(false, "Module " + this._name + " is loaded from itse
lf: " + new Error().stack); | 437 console.assert(false, "Module " + this._name + " is loaded from itse
lf: " + new Error().stack); |
| 429 Error.stackTraceLimit = oldStackTraceLimit; | 438 Error.stackTraceLimit = oldStackTraceLimit; |
| 430 return; | 439 return; |
| 431 } | 440 } |
| 432 | 441 |
| 433 this._isLoading = true; | 442 this._isLoading = true; |
| 434 var dependencies = this._descriptor.dependencies; | 443 var dependencies = this._descriptor.dependencies; |
| 435 for (var i = 0; dependencies && i < dependencies.length; ++i) | 444 for (var i = 0; dependencies && i < dependencies.length; ++i) |
| 436 this._manager.loadModule(dependencies[i]); | 445 this._manager.loadModule(dependencies[i]); |
| 437 var scripts = this._descriptor.scripts; | 446 if (this._descriptor.scripts) |
| 438 for (var i = 0; scripts && i < scripts.length; ++i) | 447 loadScript(this._name + "/_module.js"); |
| 439 loadScript(this._name + "/" + scripts[i]); | |
| 440 this._isLoading = false; | 448 this._isLoading = false; |
| 441 this._loaded = true; | 449 this._loaded = true; |
| 442 } | 450 } |
| 443 } | 451 } |
| 444 | 452 |
| 445 /** | 453 /** |
| 446 * @constructor | 454 * @constructor |
| 447 * @param {!Runtime.Module} module | 455 * @param {!Runtime.Module} module |
| 448 * @param {!Runtime.ExtensionDescriptor} descriptor | 456 * @param {!Runtime.ExtensionDescriptor} descriptor |
| 449 */ | 457 */ |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 this._instance = new constructorFunction(); | 523 this._instance = new constructorFunction(); |
| 516 } | 524 } |
| 517 return this._instance; | 525 return this._instance; |
| 518 } | 526 } |
| 519 } | 527 } |
| 520 | 528 |
| 521 /** | 529 /** |
| 522 * @type {!Runtime} | 530 * @type {!Runtime} |
| 523 */ | 531 */ |
| 524 var runtime; | 532 var runtime; |
| OLD | NEW |