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

Method valueToTypedArray

valdi/src/valdi/v8/V8JavaScriptContext.cpp:900–913  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

898 } else if (!val->IsObject()) {
899 exceptionTracker.onError("Provided js value is not object");
900 return Ref<RefCountable>();
901 } else if (objectInfo.second != kWrappedObjectID) {
902 exceptionTracker.onError("Provided js value is not a wrapped object");
903 return Ref<RefCountable>();
904 }
905
906 SC_ASSERT(val->InternalFieldCount() == static_cast<int>(InternalFieldSlot::Count));
907 auto external = v8::Local<v8::External>::Cast(val->GetInternalField(static_cast<int>(InternalFieldSlot::DataSlot)));
908 if (!external->IsExternal()) {
909 exceptionTracker.onError("Internal field value is not of type external");
910 }
911
912 return unsafeBridge<RefCountable>(external->Value());
913}
914
915JSTypedArray V8JavaScriptContext::valueToTypedArray(const JSValue& value, JSExceptionTracker& exceptionTracker) {
916 v8::HandleScope handleScope(_isolate);

Callers 1

marshallMethod · 0.45

Calls 7

JSTypedArrayClass · 0.85
BufferMethod · 0.80
fromValdiJSValueFunction · 0.70
getTypedArrayTypeFunction · 0.70
onErrorMethod · 0.65
CastFunction · 0.50
DataMethod · 0.45

Tested by

no test coverage detected