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

Method dumpLogs

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

Source from the content-addressed store, hash-verified

3502 return;
3503 }
3504
3505 auto jsModule = importResult->getJsValue(jsEntry.jsContext, jsEntry.exceptionTracker);
3506 if (!jsEntry.exceptionTracker) {
3507 return;
3508 }
3509
3510 JSFunctionCallContext callContext(jsEntry.jsContext, nullptr, 0, jsEntry.exceptionTracker);
3511 auto converter =
3512 jsEntry.jsContext.callObjectProperty(jsModule, parsedPath.getSymbolName().toStringView(), callContext);
3513 if (!jsEntry.exceptionTracker) {
3514 return;
3515 }
3516
3517 auto& typeConverter = _typeConverters.emplace_back();
3518 typeConverter.typeName = typeName;
3519 typeConverter.functionPath = functionPath;
3520
3521 auto* valueMarshaller = jsEntry.jsContext.getValueMarshaller();
3522 if (valueMarshaller != nullptr) {
3523 valueMarshaller->registerTypeConverter(typeName, converter, jsEntry.exceptionTracker);
3524 }
3525 });
3526}
3527
3528MainThreadManager* JavaScriptRuntime::getMainThreadManager() const {
3529 return &_mainThreadManager;
3530}
3531
3532StyleAttributesCache& JavaScriptRuntime::getStyleAttributesCache() {
3533 if (VALDI_UNLIKELY(_styleAttributesCache == nullptr)) {
3534 _styleAttributesCache = std::make_unique<StyleAttributesCache>(_attributeIds);
3535 }
3536 return *_styleAttributesCache;
3537}
3538
3539JSValueRef JavaScriptRuntime::symbolicateError(const JSValueRef& error) {
3540 if (_javaScriptContext == nullptr || _symbolicating) {
3541 return error;
3542 }
3543
3544 auto& jsContext = *_javaScriptContext;
3545 _symbolicating = true;
3546
3547 JSExceptionTracker exceptionTracker(jsContext);
3548 if (_symbolicateFunction.empty()) {
3549 JavaScriptEntryParameters jsEntry(jsContext, exceptionTracker, nullptr);
3550 auto module = exceptionTracker.toResult(importModule(symbolicatorResourceId(), jsEntry));
3551 if (module) {
3552 auto jsValue = module.value()->getJsValue(jsContext, exceptionTracker);
3553 if (exceptionTracker) {
3554 _symbolicateFunction = exceptionTracker.toRetainedResult(
3555 jsContext.getObjectProperty(jsValue, "symbolicate", jsEntry.exceptionTracker));
3556 } else {
3557 _symbolicateFunction = exceptionTracker.toResult(JSValueRef::makeUnretained(jsContext, jsValue));
3558 }
3559 } else {
3560 _symbolicateFunction = module.moveError();
3561 }

Callers

nothing calls this directly

Calls 15

jsValueToValueFunction · 0.85
set_valueMethod · 0.80
extractErrorMethod · 0.80
getJsValueMethod · 0.80
appendVerboseMethod · 0.80
appendMetadataMethod · 0.80
getMethod · 0.65
prependMethod · 0.65
getMapMethod · 0.65
getObjectPropertyMethod · 0.45
newBoolMethod · 0.45

Tested by

no test coverage detected