This commit is contained in:
parent
4b3608371f
commit
ba2bae80fa
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -170,16 +170,21 @@ function createEmscriptenModuleInstance(resourceLoader: WebAssemblyResourceLoade
|
||||||
module.postRun = [];
|
module.postRun = [];
|
||||||
(module as any).preloadPlugins = [];
|
(module as any).preloadPlugins = [];
|
||||||
|
|
||||||
|
// Begin loading the .dll/.pdb/.wasm files, but don't block here. Let other loading processes run in parallel.
|
||||||
|
const dotnetWasmResourceName = 'dotnet.wasm';
|
||||||
|
const assembliesBeingLoaded = resourceLoader.loadResources(resources.assembly, filename => `_framework/_bin/${filename}`);
|
||||||
|
const pdbsBeingLoaded = resourceLoader.loadResources(resources.pdb || {}, filename => `_framework/_bin/${filename}`);
|
||||||
|
const wasmBeingLoaded = resourceLoader.loadResource(
|
||||||
|
/* name */ dotnetWasmResourceName,
|
||||||
|
/* url */ `_framework/wasm/${dotnetWasmResourceName}`,
|
||||||
|
/* hash */ resourceLoader.bootConfig.resources.runtime[dotnetWasmResourceName]);
|
||||||
|
|
||||||
// Override the mechanism for fetching the main wasm file so we can connect it to our cache
|
// Override the mechanism for fetching the main wasm file so we can connect it to our cache
|
||||||
module.instantiateWasm = (imports, successCallback): WebAssembly.Exports => {
|
module.instantiateWasm = (imports, successCallback): WebAssembly.Exports => {
|
||||||
(async () => {
|
(async () => {
|
||||||
let compiledInstance: WebAssembly.Instance;
|
let compiledInstance: WebAssembly.Instance;
|
||||||
try {
|
try {
|
||||||
const dotnetWasmResourceName = 'dotnet.wasm';
|
const dotnetWasmResource = await wasmBeingLoaded;
|
||||||
const dotnetWasmResource = await resourceLoader.loadResource(
|
|
||||||
/* name */ dotnetWasmResourceName,
|
|
||||||
/* url */ `_framework/wasm/${dotnetWasmResourceName}`,
|
|
||||||
/* hash */ resourceLoader.bootConfig.resources.runtime[dotnetWasmResourceName]);
|
|
||||||
compiledInstance = await compileWasmModule(dotnetWasmResource, imports);
|
compiledInstance = await compileWasmModule(dotnetWasmResource, imports);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
module.printErr(ex);
|
module.printErr(ex);
|
||||||
|
|
@ -200,12 +205,8 @@ function createEmscriptenModuleInstance(resourceLoader: WebAssemblyResourceLoade
|
||||||
// Fetch the assemblies and PDBs in the background, telling Mono to wait until they are loaded
|
// Fetch the assemblies and PDBs in the background, telling Mono to wait until they are loaded
|
||||||
// Mono requires the assembly filenames to have a '.dll' extension, so supply such names regardless
|
// Mono requires the assembly filenames to have a '.dll' extension, so supply such names regardless
|
||||||
// of the extensions in the URLs. This allows loading assemblies with arbitrary filenames.
|
// of the extensions in the URLs. This allows loading assemblies with arbitrary filenames.
|
||||||
resourceLoader.loadResources(resources.assembly, filename => `_framework/_bin/${filename}`)
|
assembliesBeingLoaded.forEach(r => addResourceAsAssembly(r, changeExtension(r.name, '.dll')));
|
||||||
.forEach(r => addResourceAsAssembly(r, changeExtension(r.name, '.dll')));
|
pdbsBeingLoaded.forEach(r => addResourceAsAssembly(r, r.name));
|
||||||
if (resources.pdb) {
|
|
||||||
resourceLoader.loadResources(resources.pdb, filename => `_framework/_bin/${filename}`)
|
|
||||||
.forEach(r => addResourceAsAssembly(r, r.name));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
module.postRun.push(() => {
|
module.postRun.push(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue