Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup emSetImmediate/emClearImmediate. NFC #22890

Merged
merged 1 commit into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions src/library_eventloop.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ LibraryJSEventLoop = {
setImmediateWrapped.mapping[id] = undefined;
},

$polyfillSetImmediate__deps: ['$setImmediateWrapped', '$clearImmediateWrapped'],
$polyfillSetImmediate__postset: `
var emSetImmediate;
var emClearImmediate;
$emSetImmediate__deps: ['$setImmediateWrapped', '$clearImmediateWrapped', '$emClearImmediate'],
$emSetImmediate__postset: `
sbc100 marked this conversation as resolved.
Show resolved Hide resolved
if (typeof setImmediate != "undefined") {
emSetImmediate = setImmediateWrapped;
emClearImmediate = clearImmediateWrapped;
Expand All @@ -82,14 +80,12 @@ LibraryJSEventLoop = {
if (index >= 0 && index < __setImmediate_queue.length) __setImmediate_queue[index] = () => {};
})
}`,
$emSetImmediate: undefined,

$polyfillSetImmediate: () => {
sbc100 marked this conversation as resolved.
Show resolved Hide resolved
// nop, used for its postset to ensure setImmediate() polyfill is
// not duplicated between emscripten_set_immediate() and
// emscripten_set_immediate_loop() if application links to both of them.
},
$emClearImmediate_deps: ['$emSetImmediate'],
$emClearImmediate: undefined,

emscripten_set_immediate__deps: ['$polyfillSetImmediate', '$callUserCallback'],
emscripten_set_immediate__deps: ['$emSetImmediate', '$callUserCallback'],
emscripten_set_immediate: (cb, userData) => {
{{{ runtimeKeepalivePush(); }}}
return emSetImmediate(() => {
Expand All @@ -98,13 +94,13 @@ LibraryJSEventLoop = {
});
},

emscripten_clear_immediate__deps: ['$polyfillSetImmediate'],
emscripten_clear_immediate__deps: ['$emClearImmediate'],
emscripten_clear_immediate: (id) => {
{{{ runtimeKeepalivePop(); }}}
emClearImmediate(id);
},

emscripten_set_immediate_loop__deps: ['$polyfillSetImmediate', '$callUserCallback'],
emscripten_set_immediate_loop__deps: ['$emSetImmediate', '$callUserCallback'],
emscripten_set_immediate_loop: (cb, userData) => {
function tick() {
callUserCallback(() => {
Expand Down
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_hello_O0.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7905
7913
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_hello_O0.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
21012
21045
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_minimal_O0.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6443
6449
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_minimal_O0.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17061
17094
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
52855
52898
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size_strict.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
51638
51681
Loading