[Webkit-unassigned] [Bug 120112] Typed Arrays have no public facing API

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 22 11:11:01 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=120112

--- Comment #14 from Geoffrey Garen <ggaren at apple.com> ---
> JS_EXPORT JSTypedArrayType JSTypedArrayGetType(JSContextRef ctx, JSValueRef value);
> JS_EXPORT JSObjectRef JSTypedArrayMake(JSContextRef ctx, JSTypedArrayType arrayType, size_t numElements);
> JS_EXPORT void * JSTypedArrayGetDataPtr(JSContextRef ctx, JSValueRef value, size_t * byteLength);

The right phrasing here would be:

JSValueGetTypedArrayType(JSContextRef ctx, JSValueRef value);
OR
JSObjectGetTypedArrayType(JSContextRef ctx, JSObjectRef value);

JSObjectMakeTypedArray(JSContextRef ctx, JSTypedArrayType arrayType, size_t numElements);

JSValueGetTypedArrayDataPtr(JSContextRef ctx, JSValueRef value, size_t * byteLength);
OR
JSObjectGetTypedArrayDataPtr(JSContextRef ctx, JSObjectRef value, size_t * byteLength);

Why does getting the data pointer require a byte length? Why do we use byte length for access but element count for creation?

It seems like the uncontroversial idea in this API is an unforgeable way to create typed arrays using the C and ObjC APIs without having to save the JS constructor objects at the start of execution. Sort of like JSObjectMakeDate and JSObjectMakeRegExp. I'd like to see a patch that does that part for C and ObjC -- it's easy to get that right without solving the hard problem of how to get a data pointer.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150922/0dce08af/attachment-0001.html>


More information about the webkit-unassigned mailing list