From 2b21395bd3316a171c475516ad59086650fff7d7 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Thu, 15 Jun 2023 15:35:40 +0900 Subject: [PATCH] [Service] Apply WebAssembly.compileForCaching() compileForCaching() has been introduced to fix wasm caching issue from: https://review.tizen.org/gerrit/293822/ Change-Id: I93e3cba22da23ff222e9514b2e3a21249d9463bd Signed-off-by: DongHyun Song --- node_modules/typescript/lib/lib.dom.d.ts | 2 ++ wrt_app/service/builtins/wasm_builder.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/node_modules/typescript/lib/lib.dom.d.ts b/node_modules/typescript/lib/lib.dom.d.ts index 56e99f03..0d9afde6 100644 --- a/node_modules/typescript/lib/lib.dom.d.ts +++ b/node_modules/typescript/lib/lib.dom.d.ts @@ -19082,6 +19082,8 @@ declare namespace WebAssembly { type ModuleImports = Record; type Imports = Record; function compile(bytes: BufferSource): Promise; + /** compileForCaching has been introduced for wasm caching builtin service **/ + function compileForCaching(bytes: BufferSource): Promise; function compileStreaming(source: Response | Promise): Promise; function instantiate(bytes: BufferSource, importObject?: Imports): Promise; function instantiate(moduleObject: Module, importObject?: Imports): Promise; diff --git a/wrt_app/service/builtins/wasm_builder.ts b/wrt_app/service/builtins/wasm_builder.ts index b9ceca9a..3ec7fe83 100644 --- a/wrt_app/service/builtins/wasm_builder.ts +++ b/wrt_app/service/builtins/wasm_builder.ts @@ -9,7 +9,7 @@ function compileWasmForCaching(files: string[]) { console.debug(`Requesting WASM compilation for building a cache, file_path:(${filePath})`); let source = fs.readFileSync(filePath); let file = new Uint8Array(source); - await WebAssembly.compile(file); + await WebAssembly.compileForCaching(file); }); } catch (e) { console.error(`An error occurred while compiling a wasm module. error:(${e})`); -- 2.34.1