MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / buildWaAsync

Method buildWaAsync

Source/Wasm/WasmRuntime.cpp:2691–2733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2689}
2690
2691void WasmRuntime::buildWaAsync(String fullPath, const std::function<void(String)>& callback) {
2692#ifdef DORA_NO_WA
2693 DORA_UNUSED_PARAM(fullPath);
2694 Error("Wa build not supported");
2695 callback("Wa build not supported"s);
2696#else // !DORA_NO_WA
2697#if BX_PLATFORM_ANDROID
2698 if (!_thread) {
2699 _thread = SharedAsyncThread.newThread();
2700 }
2701 _thread->run([fullPath = fullPath.toString()]() {
2702 auto result = WaBuild(c_cast<char*>(fullPath.c_str()));
2703 std::string data = result ? std::string(result) : "Wa build not available";
2704 if (result) {
2705 WaFreeCString(result);
2706 }
2707 return Values::alloc(std::move(data));
2708 },
2709 [callback](Own<Values> values) {
2710 std::string data;
2711 values->get(data);
2712 callback(data);
2713 });
2714#else // BX_PLATFORM_ANDROID
2715 if (!_thread) {
2716 _thread = SharedAsyncThread.newThread();
2717 }
2718 _thread->run([fullPath = fullPath.toString()]() {
2719 auto result = WaBuild(c_cast<char*>(fullPath.c_str()));
2720 std::string data = result ? std::string(result) : "Wa build not available";
2721 if (result) {
2722 WaFreeCString(result);
2723 }
2724 return Values::alloc(std::move(data));
2725 },
2726 [callback](Own<Values> values) {
2727 std::string data;
2728 values->get(data);
2729 callback(data);
2730 });
2731#endif // BX_PLATFORM_ANDROID
2732#endif // !DORA_NO_WA
2733}
2734
2735void WasmRuntime::formatWaAsync(String fullPath, const std::function<void(String)>& callback) {
2736#ifdef DORA_NO_WA

Callers

nothing calls this directly

Calls 11

stringFunction · 0.85
moveFunction · 0.85
newThreadMethod · 0.80
WaBuildFunction · 0.70
WaFreeCStringFunction · 0.70
runMethod · 0.65
toStringMethod · 0.65
getMethod · 0.65
ErrorEnum · 0.50
allocFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected