| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 186 } |
| 187 self.eval(scriptSource + '\n//# sourceURL=' + sourceURL); | 187 self.eval(scriptSource + '\n//# sourceURL=' + sourceURL); |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 | 190 |
| 191 /** | 191 /** |
| 192 * @param {string} url | 192 * @param {string} url |
| 193 * @param {boolean} appendSourceURL | 193 * @param {boolean} appendSourceURL |
| 194 * @return {!Promise<undefined>} | 194 * @return {!Promise<undefined>} |
| 195 */ | 195 */ |
| 196 static loadResourceIntoCache(url, appendSourceURL) { | 196 static _loadResourceIntoCache(url, appendSourceURL) { |
| 197 return Runtime.loadResourcePromise(url).then( | 197 return Runtime.loadResourcePromise(url).then( |
| 198 cacheResource.bind(this, url), cacheResource.bind(this, url, undefined))
; | 198 cacheResource.bind(this, url), cacheResource.bind(this, url, undefined))
; |
| 199 | 199 |
| 200 /** | 200 /** |
| 201 * @param {string} path | 201 * @param {string} path |
| 202 * @param {string=} content | 202 * @param {string=} content |
| 203 */ | 203 */ |
| 204 function cacheResource(path, content) { | 204 function cacheResource(path, content) { |
| 205 if (!content) { | 205 if (!content) { |
| 206 console.error('Failed to load resource: ' + path); | 206 console.error('Failed to load resource: ' + path); |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 * @return {!Promise.<undefined>} | 746 * @return {!Promise.<undefined>} |
| 747 * @this {Runtime.Module} | 747 * @this {Runtime.Module} |
| 748 */ | 748 */ |
| 749 _loadResources() { | 749 _loadResources() { |
| 750 var resources = this._descriptor['resources']; | 750 var resources = this._descriptor['resources']; |
| 751 if (!resources || !resources.length) | 751 if (!resources || !resources.length) |
| 752 return Promise.resolve(); | 752 return Promise.resolve(); |
| 753 var promises = []; | 753 var promises = []; |
| 754 for (var i = 0; i < resources.length; ++i) { | 754 for (var i = 0; i < resources.length; ++i) { |
| 755 var url = this._modularizeURL(resources[i]); | 755 var url = this._modularizeURL(resources[i]); |
| 756 promises.push(Runtime.loadResourceIntoCache(url, true)); | 756 promises.push(Runtime._loadResourceIntoCache(url, true)); |
| 757 } | 757 } |
| 758 return Promise.all(promises).then(undefined); | 758 return Promise.all(promises).then(undefined); |
| 759 } | 759 } |
| 760 | 760 |
| 761 /** | 761 /** |
| 762 * @return {!Promise.<undefined>} | 762 * @return {!Promise.<undefined>} |
| 763 */ | 763 */ |
| 764 _loadScripts() { | 764 _loadScripts() { |
| 765 if (!this._descriptor.scripts || !this._descriptor.scripts.length) | 765 if (!this._descriptor.scripts || !this._descriptor.scripts.length) |
| 766 return Promise.resolve(); | 766 return Promise.resolve(); |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 send: function(message) {}, | 1115 send: function(message) {}, |
| 1116 | 1116 |
| 1117 /** | 1117 /** |
| 1118 * @return {!Promise<boolean>} | 1118 * @return {!Promise<boolean>} |
| 1119 */ | 1119 */ |
| 1120 close: function() {} | 1120 close: function() {} |
| 1121 }; | 1121 }; |
| 1122 | 1122 |
| 1123 /** @type {!Runtime} */ | 1123 /** @type {!Runtime} */ |
| 1124 var runtime; | 1124 var runtime; |
| OLD | NEW |