MCPcopy Create free account
hub / github.com/Snapchat/Valdi / dispatchMessage

Function dispatchMessage

valdi/src/valdi/runtime/JavaScript/JavaScriptWorker.cpp:34–42  ·  view source on GitHub ↗

Call the onmessage function with data

Source from the content-addressed store, hash-verified

32 return JavaScriptANRAttribution::boundedLabel(STRING_FORMAT("worker.{}({})", operation, path));
33}
34
35Ref<JavaScriptRuntime> JavaScriptWorker::getWorkerRuntime() const {
36 return _workerRuntime;
37}
38
39static JSValueRef getGlobalOnMessage(JavaScriptEntryParameters& entry) {
40 auto globalObj = entry.jsContext.getGlobalObject(entry.exceptionTracker);
41 auto onMessageKey = STRING_LITERAL("onmessage");
42 auto onmessage =
43 entry.jsContext.getObjectProperty(globalObj.get(), onMessageKey.toStringView(), entry.exceptionTracker);
44 return entry.jsContext.isValueFunction(onmessage.get()) ? std::move(onmessage) : entry.jsContext.newUndefined();
45}

Callers 2

doPostInitMethod · 0.85
doPostMessageMethod · 0.85

Calls 1

ValueClass · 0.50

Tested by

no test coverage detected