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

Method formatWaAsync

Source/Wasm/WasmRuntime.cpp:2735–2777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2733}
2734
2735void WasmRuntime::formatWaAsync(String fullPath, const std::function<void(String)>& callback) {
2736#ifdef DORA_NO_WA
2737 DORA_UNUSED_PARAM(fullPath);
2738 Error("Wa format not supported");
2739 callback(Slice::Empty);
2740#else // !DORA_NO_WA
2741#if BX_PLATFORM_ANDROID
2742 if (!_thread) {
2743 _thread = SharedAsyncThread.newThread();
2744 }
2745 _thread->run([fullPath = fullPath.toString()]() {
2746 auto result = WaFormat(c_cast<char*>(fullPath.c_str()));
2747 std::string data = result ? std::string(result) : ""s;
2748 if (result) {
2749 WaFreeCString(result);
2750 }
2751 return Values::alloc(std::move(data));
2752 },
2753 [callback](Own<Values> values) {
2754 std::string data;
2755 values->get(data);
2756 callback(data);
2757 });
2758#else // BX_PLATFORM_ANDROID
2759 if (!_thread) {
2760 _thread = SharedAsyncThread.newThread();
2761 }
2762 _thread->run([fullPath = fullPath.toString()]() {
2763 auto result = WaFormat(c_cast<char*>(fullPath.c_str()));
2764 std::string data = result ? std::string(result) : ""s;
2765 if (result) {
2766 WaFreeCString(result);
2767 }
2768 return Values::alloc(std::move(data));
2769 },
2770 [callback](Own<Values> values) {
2771 std::string data;
2772 values->get(data);
2773 callback(data);
2774 });
2775#endif // BX_PLATFORM_ANDROID
2776#endif // !DORA_NO_WA
2777}
2778
2779static bool IsGitTerminalStatus(const std::string& status) {
2780 return status.find("\"state\":\"done\"") != std::string::npos

Callers

nothing calls this directly

Calls 11

stringFunction · 0.85
moveFunction · 0.85
newThreadMethod · 0.80
WaFormatFunction · 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