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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return new Worker(moduleName + "/_module.js"); | 125 return new Worker(moduleName + "/_module.js"); |
126 } | 126 } |
127 | 127 |
128 Runtime.prototype = { | 128 Runtime.prototype = { |
129 /** | 129 /** |
130 * @param {!Array.<string>} configuration | 130 * @param {!Array.<string>} configuration |
131 */ | 131 */ |
132 registerModules: function(configuration) | 132 registerModules: function(configuration) |
133 { | 133 { |
134 for (var i = 0; i < configuration.length; ++i) | 134 for (var i = 0; i < configuration.length; ++i) |
135 this.registerModule(configuration[i]); | 135 this._registerModule(configuration[i]); |
136 }, | 136 }, |
137 | 137 |
138 /** | 138 /** |
139 * @param {string} moduleName | 139 * @param {string} moduleName |
140 */ | 140 */ |
141 registerModule: function(moduleName) | 141 _registerModule: function(moduleName) |
142 { | 142 { |
143 if (!this._descriptorsMap[moduleName]) { | 143 if (!this._descriptorsMap[moduleName]) { |
144 var content = loadResource(moduleName + "/module.json"); | 144 var content = loadResource(moduleName + "/module.json"); |
145 if (!content) | 145 if (!content) |
146 throw new Error("Module is not defined: " + moduleName + " " + n
ew Error().stack); | 146 throw new Error("Module is not defined: " + moduleName + " " + n
ew Error().stack); |
147 var module = /** @type {!Runtime.ModuleDescriptor} */ (self.eval("("
+ content + ")")); | 147 var module = /** @type {!Runtime.ModuleDescriptor} */ (self.eval("("
+ content + ")")); |
148 module["name"] = moduleName; | 148 module["name"] = moduleName; |
149 this._descriptorsMap[moduleName] = module; | 149 this._descriptorsMap[moduleName] = module; |
150 } | 150 } |
151 var module = new Runtime.Module(this, this._descriptorsMap[moduleName]); | 151 var module = new Runtime.Module(this, this._descriptorsMap[moduleName]); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 this._instance = new constructorFunction(); | 523 this._instance = new constructorFunction(); |
524 } | 524 } |
525 return this._instance; | 525 return this._instance; |
526 } | 526 } |
527 } | 527 } |
528 | 528 |
529 /** | 529 /** |
530 * @type {!Runtime} | 530 * @type {!Runtime} |
531 */ | 531 */ |
532 var runtime; | 532 var runtime; |
OLD | NEW |