Skip to content
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
17 changes: 9 additions & 8 deletions src/shell_minimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,23 @@ if (ENVIRONMENT_IS_NODE) {
}
#endif

#if WASM_WORKERS
#if AUDIO_WORKLET
var ENVIRONMENT_IS_AUDIO_WORKLET = !!globalThis.AudioWorkletGlobalScope;
#endif

#if AUDIO_WORKLET && WASM_WORKERS
var ENVIRONMENT_IS_WASM_WORKER = globalThis.name == 'em-ww' || ENVIRONMENT_IS_AUDIO_WORKLET;
#elif WASM_WORKERS
var ENVIRONMENT_IS_WASM_WORKER = globalThis.name == 'em-ww';
#endif

#if ENVIRONMENT_MAY_BE_NODE
#if WASM_WORKERS && ENVIRONMENT_MAY_BE_NODE
if (ENVIRONMENT_IS_NODE) {
// The way we signal to a worker that it is hosting a pthread is to construct
// it with a specific name.
ENVIRONMENT_IS_WASM_WORKER = worker_threads['workerData'] == 'em-ww'
}
#endif
#endif

#if AUDIO_WORKLET
var ENVIRONMENT_IS_AUDIO_WORKLET = !!globalThis.AudioWorkletGlobalScope;
if (ENVIRONMENT_IS_AUDIO_WORKLET) ENVIRONMENT_IS_WASM_WORKER = true;
#endif

#if ASSERTIONS && ENVIRONMENT_MAY_BE_NODE && ENVIRONMENT_MAY_BE_SHELL
if (ENVIRONMENT_IS_NODE && ENVIRONMENT_IS_SHELL) {
Expand Down
16 changes: 7 additions & 9 deletions test/codesize/audio_worklet_wasm.expected.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
var m = globalThis.Module || "undefined" != typeof Module ? Module : {}, q = "em-ww" == globalThis.name, r = !!globalThis.AudioWorkletGlobalScope, t, z, J, K, H, E, v, X, F, D, C, Y, A, Z;

r && (q = !0);
var m = globalThis.Module || "undefined" != typeof Module ? Module : {}, q = !!globalThis.AudioWorkletGlobalScope, r = "em-ww" == globalThis.name || q, t, z, J, K, H, E, v, X, F, D, C, Y, A, Z;

function u(a) {
t = a;
Expand All @@ -12,12 +10,12 @@ function u(a) {
a.G = a.M = 0;
}

q && !r && (onmessage = a => {
r && !q && (onmessage = a => {
onmessage = null;
u(a.data);
});

if (r) {
if (q) {
function a(e) {
class d extends AudioWorkletProcessor {
constructor(c) {
Expand Down Expand Up @@ -98,7 +96,7 @@ function w() {
E = new Float32Array(a);
}

q || (v = m.mem || new WebAssembly.Memory({
r || (v = m.mem || new WebAssembly.Memory({
initial: 256,
maximum: 256,
shared: !0
Expand Down Expand Up @@ -236,9 +234,9 @@ function y() {
C = a.n;
Y = a.o;
A = a.k;
q ? (Y(t.J, t.F), r || (removeEventListener("message", N), L = L.forEach(M), addEventListener("message", M))) : a.i();
q || X();
r ? (Y(t.J, t.F), q || (removeEventListener("message", N), L = L.forEach(M), addEventListener("message", M))) : a.i();
r || X();
}));
}

q || y();
r || y();
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.html": 519,
"a.html.gz": 357,
"a.js": 3866,
"a.js.gz": 2041,
"a.js": 3859,
"a.js.gz": 2037,
"a.wasm": 1308,
"a.wasm.gz": 876,
"total": 5693,
"total_gz": 3274
"total": 5686,
"total_gz": 3270
}