| 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 | |
| 552 | Result<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; |
nothing calls this directly
no test coverage detected