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

Method valueToStaticString

valdi/src/valdi/jscore/JavaScriptCoreContext.cpp:532–552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

530
531Valdi::JSValueRef JavaScriptCoreContext::newArrayBuffer(const Valdi::BytesView& buffer,
532 Valdi::JSExceptionTracker& exceptionTracker) {
533 auto context = getJSGlobalContext();
534 JSValueRef exception = nullptr;
535 JSObjectRef arrayBuffer = nullptr;
536 if (buffer.empty()) {
537 arrayBuffer = _emptyArrayBuffer;
538 } else {
539 arrayBuffer = JSObjectMakeArrayBufferWithBytesNoCopy(context,
540 const_cast<Valdi::Byte*>(buffer.data()),
541 buffer.size(),
542 &bufferDeallocator,
543 Valdi::unsafeBridgeRetain(buffer.getSource().get()),
544 &exception);
545 if (exception != nullptr) {
546 // The bufferDeallocator will always be called if an exception is thrown
547 // No need to worry about deleting the buffer here
548 return checkCallAndGetValue(exceptionTracker, arrayBuffer, exception);
549 }
550 }
551
552 return returnJSValueRef(arrayBuffer, kJSTypeObject);
553}
554
555Valdi::JSValueRef JavaScriptCoreContext::newTypedArrayFromArrayBuffer(const Valdi::TypedArrayType& type,

Callers

nothing calls this directly

Calls 2

jsStringToUTF8Function · 0.85
fromValdiJSValueFunction · 0.70

Tested by

no test coverage detected