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

Method getObjectPropertyForIndex

valdi/src/valdi/v8/V8JavaScriptContext.cpp:561–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559 case ArrayBuffer:
560 return JSValueRef::makeRetained(*this, arrayBuffer);
561 }
562
563 return toRetainedJSValueRef(IndirectV8Persistent::make(_isolate, retval));
564}
565
566JSValueRef V8JavaScriptContext::newWrappedObject(const Ref<RefCountable>& wrappedObject,
567 JSExceptionTracker& exceptionTracker) {
568 v8::HandleScope handleScope(_isolate);
569 v8::Local<v8::Context> context = v8::Local<v8::Context>::New(_isolate, _context);
570
571 auto valdiObjectTemplate = _valdiObjectTemplate.Get(_isolate);
572 v8::Local<v8::Object> val;
573 if (!valdiObjectTemplate->NewInstance(context).ToLocal(&val)) {
574 exceptionTracker.onError("Cannot create wrapper object");
575 return JSValueRef();
576 }
577
578 auto externalData =
579 IndirectV8Persistent::makeWeakExternal(_isolate, unsafeBridgeRetain(wrappedObject.get()), freeWrappedPointer);
580
581 val->SetInternalField(static_cast<int>(InternalFieldSlot::DataSlot), externalData);
582 return toRetainedJSValueRef(IndirectV8Persistent::make(_isolate, val));
583}
584
585JSValueRef V8JavaScriptContext::newNativeClass(const Ref<RefCountable>& /*classOpaque*/,
586 const JSClassDefinition& /*classDefinition*/,
587 JSExceptionTracker& exceptionTracker) {
588 // TODO: Implement native-class support or Base64/Unicode module fallbacks before enabling V8.

Callers 8

jsArrayToValueFunction · 0.45
visitES6CollectionMethod · 0.45
getArrayItemMethod · 0.45
setProtobufRepeatedFieldFunction · 0.45
getMessageIndexesFunction · 0.45
codepointsToStrMethod · 0.45
mainFunction · 0.45

Calls 6

ToLocalMethod · 0.80
fromValdiJSValueFunction · 0.70
onErrorMethod · 0.65
NewFunction · 0.50
CastFunction · 0.50
GetMethod · 0.45

Tested by

no test coverage detected