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

Method doCall

valdi/src/valdi/runtime/JavaScript/JSFunctionWithValueFunction.cpp:75–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73 VALDI_TRACE_META("Valdi.jsBridgeToNative", getFunctionName());
74
75 auto function = getFunction(callContext.getContext(), callContext.getExceptionTracker(), _isSingleCall);
76 CHECK_CALL_CONTEXT(callContext);
77
78 ScopedNativeCallActivity nativeCallActivity(javaScriptRuntimeOf(getContext()), getFunctionName());
79
80 if (function->propagatesOwnerContextOnCall()) {
81 return callWithOwnerContextAsCurrent(function, callContext);
82 } else {
83 return doCall(function, &_functionName, callContext);
84 }
85}
86
87JSFunctionWithUntypedValueFunction::JSFunctionWithUntypedValueFunction(Ref<ValueFunction>&& function,
88 const ReferenceInfo& referenceInfo)
89 : JSFunctionWithValueFunction(std::move(function), false, referenceInfo) {}
90
91JSValueRef JSFunctionWithUntypedValueFunction::doCall(const Ref<ValueFunction>& function,
92 const StringBox* precomputedFunctionIdentifier,
93 JSFunctionNativeCallContext& callContext) const {
94 auto referenceInfoBuilder = ReferenceInfoBuilder(getReferenceInfo());
95 Valdi::SmallVector<Value, 8> outParameters;
96 {
97 VALDI_TRACE("Valdi.jsParametersToCpp");
98
99 for (size_t i = 0, size = callContext.getParameterSize(); i < size; i++) {
100 auto jsValue = callContext.getParameter(i);
101
102 auto convertedParameterResult = jsValueToValue(callContext.getContext(),
103 jsValue,
104 referenceInfoBuilder.withParameter(i),
105 callContext.getExceptionTracker());
106 if (!callContext.getExceptionTracker()) {
107 return callContext.getContext().newUndefined();
108 }
109
110 outParameters.emplace_back(std::move(convertedParameterResult));

Callers

nothing calls this directly

Calls 12

jsValueToValueFunction · 0.85
valueToJSValueFunction · 0.85
getParameterSizeMethod · 0.80
getParameterMethod · 0.80
withParameterMethod · 0.80
newUndefinedMethod · 0.80
setFunctionIdentifierMethod · 0.80
withReturnValueMethod · 0.80
getContextMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected