[Bug 28798] Make BufferSource more convenient to use

https://www.w3.org/Bugs/Public/show_bug.cgi?id=28798

--- Comment #16 from Boris Zbarsky <bzbarsky@mit.edu> ---
> Can you explain why this would be? 

Well, let's take an example WebGL API:

    void bufferData(GLenum target, ArrayBuffer? data, GLenum usage);

If we do the copying at argument conversion time, we MUST make a copy when we
process the "data" argument, because processing the "usage" argument can detach
the ArrayBuffer (e.g. if the thing passed for the third argument is { valueOf:
function() { /* detach stuff here*/ return something; } }).  Then we have to
hand over the buffer to the actual graphics driver, which involves another
buffer copy.

If we do the copying at entry-into-prose time (which I will be the first to
admit is much harder to specify and implement!) then the implementation could
make the handoff to the graphics driver be the only copy, as long as it's
careful to not enter script in any way between entry into the algorithm and the
call into the graphics driver.

If the array is big, having to do an extra copy can be pretty painful, both in
terms of memory usage and time....

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Thursday, 11 February 2016 15:48:37 UTC