[Webkit-unassigned] [Bug 123058] JSC should have an API for typed arrays

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Oct 19 13:52:36 PDT 2013


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





--- Comment #7 from Filip Pizlo <fpizlo at apple.com>  2013-10-19 13:51:21 PST ---
(In reply to comment #6)
> (In reply to comment #4)
> > I think Alexey is also asking for a way to create typed arrays.
> > 
> > > JSGetTypedArrayBase(JSValueRef) -> returns void* of the first element in the view or the base of the buffer
> > > JSGetTypedArrayByteLength(JSValueRef) -> returns size_t of the number of bytes that the view sees or the byteLength of the buffer.
> > 
> > This would be 
> > 
> > JSObjectGetTypedArrayBase(JSContextRef, JSValueRef)
> > JSObjectGetTypedArrayByteLength(JSContextRef, JSValueRef)
> 
> OK, but out of curiosity, does it have to be?  You can get a JSGenericTypedArrayView's base and length without an ExecState*.
> 
> > 
> > Maybe "BytesPtr" is a better name than "Base", to match our string and data APIs.
> 
> Yeah.
> 
> > 
> > How would I know the data type in the typed array?
> 
> Why would a client care?  If they did, they can already get the element type using JS constructs.
> 
> > How long would the returned pointer remain valid?
> 
> Only so long as the JSValueRef of the buffer or view was live and so long as it wasn't neutered.

And to clarify, we will ensure that the returned buffer pointer was pinned by doing slowDownAndWasteMemory().

> 
> > What happens after neutering?
> 
> It's interesting to note that neutering is purely a DOM construct - it will only happen if you use the JS API in conjunction with a WebView.
> 
> Neutering will free the buffer so your pointer will become invalid.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list