From: DongHyun Song Date: Thu, 15 Jun 2023 06:35:40 +0000 (+0900) Subject: [Service] Apply WebAssembly.compileForCaching() X-Git-Tag: submit/tizen/20230616.160024^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2b21395bd3316a171c475516ad59086650fff7d7;p=platform%2Fframework%2Fweb%2Fwrtjs.git [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 --- 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})`);