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

Method executeMainFileAsync

Source/Wasm/WasmRuntime.cpp:2380–2406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2378}
2379
2380void WasmRuntime::executeMainFileAsync(String filename, const std::function<void(bool)>& handler) {
2381 if (!_scheduler) {
2382 scheduleUpdate();
2383 }
2384 auto instance = New<WasmInstance>();
2385 auto moduleId = allocModuleId(instance.get());
2386 if (moduleId == 0) {
2387 Error("failed to allocate wasm module id for {}", filename.toString());
2388 handler(false);
2389 return;
2390 }
2391 instance->setModuleId(moduleId);
2392 auto* instancePtr = instance.get();
2393 _instances.push_back(std::move(instance));
2394 instancePtr->executeMainFileAsync(filename, [this, instancePtr, handler](bool result) {
2395 if (!result) {
2396 releaseModuleId(instancePtr->getModuleId());
2397 auto it = std::find_if(_instances.begin(), _instances.end(), [instancePtr](const auto& item) {
2398 return item.get() == instancePtr;
2399 });
2400 if (it != _instances.end()) {
2401 _instances.erase(it);
2402 }
2403 }
2404 handler(result);
2405 });
2406}
2407
2408void WasmInstance::executeMainFileAsync(String filename, const std::function<void(bool)>& handler) {
2409 if (_wasm.first || _loading) {

Callers

nothing calls this directly

Calls 15

handlerFunction · 0.85
moveFunction · 0.85
linkDoraModuleFunction · 0.85
VersionToStrFunction · 0.85
setModuleIdMethod · 0.80
getModuleIdMethod · 0.80
loadAsyncDataMethod · 0.80
new_runtimeMethod · 0.80
set_userdataMethod · 0.80
parse_moduleMethod · 0.80
link_defaultMethod · 0.80
find_functionMethod · 0.80

Tested by

no test coverage detected