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

Method runtimeOutputLog

valdi/src/valdi/runtime/JavaScript/JavaScriptRuntime.cpp:533–565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

531 const char* functionName,
532 JSValueRef (JavaScriptRuntime::*function)(JSFunctionNativeCallContext&)) {
533 auto functionNameStr = STRING_LITERAL(functionName);
534 auto objectName = STRING_LITERAL("runtime");
535 auto callable = makeShared<JavaScriptRuntimeCallable>(
536 *this,
537 function,
538 ReferenceInfoBuilder().withObject(objectName).withProperty(functionNameStr).asFunction().build());
539
540 auto jsFunction = jsContext.newFunction(callable, exceptionTracker);
541 if (!exceptionTracker) {
542 return;
543 }
544
545 jsContext.setObjectProperty(
546 jsObject.get(), functionNameStr.toStringView(), jsFunction.get(), true, exceptionTracker);
547 if (!exceptionTracker) {
548 return;
549 }
550}
551
552Result<Void> JavaScriptRuntime::initializeContext() {
553 VALDI_TRACE("Valdi.createJsContext");
554 Ref<ValdiRuntimeTweaks> runtimeTweaks;
555 if (auto listener = getListener()) {
556 runtimeTweaks = listener->getRuntimeTweaks();
557 }
558
559 if (runtimeTweaks != nullptr) {
560 Context::setDestroyedContextFixEnabled(runtimeTweaks->enableRenderRequestContextFix());
561 MainThreadManager::setPreRasterFenceDisabled(runtimeTweaks->disablePreRasterFence());
562 }
563
564 VALDI_INFO(*_logger, "Creating JSContext from engine '{}'", _javaScriptBridge.getName());
565
566 auto jsContext = _javaScriptBridge.createJsContext(this, *_logger);
567
568 std::unique_ptr<JavaScriptRuntimeDeserializers> runtimeDeserializers;

Callers

nothing calls this directly

Calls 10

getParameterMethod · 0.80
newUndefinedMethod · 0.80
throwErrorMethod · 0.65
logMethod · 0.65
ErrorInterface · 0.50
valueToIntMethod · 0.45
getContextMethod · 0.45
isEnabledForTypeMethod · 0.45
valueToStaticStringMethod · 0.45
toStdStringMethod · 0.45

Tested by

no test coverage detected