[canvaskit] Fix some other usages of .ready
Leftover from https://skia-review.googlesource.com/c/skia/+/291182
Change-Id: I7350839d43299846e9e9cbc58425013eb063b041
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291356
Reviewed-by: Kevin Lubick <kjlubick@google.com>
diff --git a/experimental/skottiekit/compile.sh b/experimental/skottiekit/compile.sh
index 34de427..be1909c 100755
--- a/experimental/skottiekit/compile.sh
+++ b/experimental/skottiekit/compile.sh
@@ -163,11 +163,11 @@
$WASM_GPU \
-std=c++17 \
--bind \
+ --no-entry \
--pre-js $BASE_DIR/preamble.js \
--pre-js $BASE_DIR/helper.js \
--pre-js $BASE_DIR/interface.js \
--pre-js $BASE_DIR/postamble.js \
- --post-js $BASE_DIR/ready.js \
$BASE_DIR/skottiekit_bindings.cpp \
modules/skresources/src/SkResources.cpp \
$MANAGED_SKOTTIE_BINDINGS \
@@ -182,7 +182,7 @@
-s MODULARIZE=1 \
-s NO_EXIT_RUNTIME=1 \
-s STRICT=1 \
- -s TOTAL_MEMORY=128MB \
+ -s INITIAL_MEMORY=128MB \
-s WARN_UNALIGNED=1 \
-s WASM=1 \
-o $BUILD_DIR/skottiekit.js
diff --git a/experimental/skottiekit/examples/ck.html b/experimental/skottiekit/examples/ck.html
index 03b75ee..e936743 100644
--- a/experimental/skottiekit/examples/ck.html
+++ b/experimental/skottiekit/examples/ck.html
@@ -14,7 +14,7 @@
// loadKit resolves with CanvasKit.
const loadKit = CanvasKitInit({
locateFile: (file) => 'https://particles.skia.org/static/'+file,
- }).ready();
+ });
loadKit.then(() => {
const n = performance.now();
diff --git a/experimental/skottiekit/examples/index.html b/experimental/skottiekit/examples/index.html
index af02c79..9c4e240 100644
--- a/experimental/skottiekit/examples/index.html
+++ b/experimental/skottiekit/examples/index.html
@@ -14,7 +14,7 @@
// loadKit resolves with SkottieKit.
const loadKit = SkottieKitInit({
locateFile: (file) => '/bin/'+file,
- }).ready();
+ });
loadKit.then(() => {
const n = performance.now();
diff --git a/experimental/skottiekit/ready.js b/experimental/skottiekit/ready.js
deleted file mode 100644
index 60f2486..0000000
--- a/experimental/skottiekit/ready.js
+++ /dev/null
@@ -1,16 +0,0 @@
-// See https://github.com/kripken/emscripten/issues/5820#issuecomment-385722568
-// for context on why the .then() that comes with Module breaks things (e.g. infinite loops)
-// and why the below fixes it.
-Module['ready'] = function() {
- return new Promise(function (resolve, reject) {
- Module['onAbort'] = reject;
- if (runtimeInitialized) {
- resolve(Module);
- } else {
- addOnPostRun(function() {
- resolve(Module);
- });
- }
- });
-}
-delete Module['then'];
\ No newline at end of file
diff --git a/tools/perf-canvaskit-puppeteer/skottie-frames.html b/tools/perf-canvaskit-puppeteer/skottie-frames.html
index f6bbf1a..4205ef8 100644
--- a/tools/perf-canvaskit-puppeteer/skottie-frames.html
+++ b/tools/perf-canvaskit-puppeteer/skottie-frames.html
@@ -36,7 +36,7 @@
const loadKit = CanvasKitInit({
locateFile: (file) => '/static/' + file,
- }).ready();
+ });
const loadLottie = fetch(LOTTIE_JSON_PATH).then((resp) => {
return resp.text()
diff --git a/tools/skottie-wasm-perf/skottie-wasm-perf.html b/tools/skottie-wasm-perf/skottie-wasm-perf.html
index f7fd4a1..dd2ac62 100644
--- a/tools/skottie-wasm-perf/skottie-wasm-perf.html
+++ b/tools/skottie-wasm-perf/skottie-wasm-perf.html
@@ -26,7 +26,7 @@
CanvasKitInit({
locateFile: (file) => '/res/'+file,
- }).ready().then((CanvasKit) => {
+ }).then((CanvasKit) => {
CK = CanvasKit;
Bench(CK, lottieJSON);
});