Skip to content

Commit 1ddef04

Browse files
authored
Simplify asyncLoad. NFC (#23100)
Turns out non of the callers were relying the adding of the run dependencies here. There are 4 call sites total: - emscripten_async_wget_data: Explicitly sets noRunDep - emscripten_wget_data: Explicitly sets noRunDep - loadDynamicLibrary: The outer loadDylibs already has an explicit calls to addRunDependency/removeRunDependency. - FS_createPreloadedFile: Already has an explicit calls to addRunDependency/removeRunDependency.
1 parent f130663 commit 1ddef04

File tree

5 files changed

+5
-9
lines changed

5 files changed

+5
-9
lines changed

src/library.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -2181,18 +2181,14 @@ addToLibrary({
21812181
return x.startsWith('dynCall_') ? x : '_' + x;
21822182
},
21832183

2184-
$asyncLoad__docs: '/** @param {boolean=} noRunDep */',
2185-
$asyncLoad: (url, noRunDep) => {
2184+
$asyncLoad: (url) => {
21862185
return new Promise((resolve, reject) => {
2187-
var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : '';
2188-
if (dep) addRunDependency(dep);
21892186
readAsync(url).then(
21902187
(arrayBuffer) => {
21912188
#if ASSERTIONS
21922189
assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`);
21932190
#endif
21942191
resolve(new Uint8Array(arrayBuffer));
2195-
if (dep) removeRunDependency(dep);
21962192
}, reject);
21972193
});
21982194
},

src/library_async.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ addToLibrary({
471471
emscripten_wget_data: (url, pbuffer, pnum, perror) => {
472472
return Asyncify.handleSleep((wakeUp) => {
473473
/* no need for run dependency, this is async but will not do any prepare etc. step */
474-
asyncLoad(UTF8ToString(url), /*noRunDep=*/true).then((byteArray) => {
474+
asyncLoad(UTF8ToString(url)).then((byteArray) => {
475475
// can only allocate the buffer after the wakeUp, not during an asyncing
476476
var buffer = _malloc(byteArray.length); // must be freed by caller!
477477
HEAPU8.set(byteArray, buffer);

src/library_wget.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ var LibraryWget = {
6565
emscripten_async_wget_data: (url, userdata, onload, onerror) => {
6666
{{{ runtimeKeepalivePush() }}}
6767
/* no need for run dependency, this is async but will not do any prepare etc. step */
68-
asyncLoad(UTF8ToString(url), /*noRunDep=*/true).then((byteArray) => {
68+
asyncLoad(UTF8ToString(url)).then((byteArray) => {
6969
{{{ runtimeKeepalivePop() }}}
7070
callUserCallback(() => {
7171
var buffer = _malloc(byteArray.length);
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6294
1+
6276
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
13863
1+
13831

0 commit comments

Comments
 (0)