W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

Re: Should send() be able to take an ArrayBufferView?

From: Charles Pritchard <chuck@jumis.com>
Date: Wed, 11 Apr 2012 14:54:01 -0700
Message-ID: <4F85FD79.3080006@jumis.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
CC: Kenneth Russell <kbr@google.com>, public-webapps <public-webapps@w3.org>
On 4/11/2012 2:50 PM, Boris Zbarsky wrote:
> On 4/11/12 5:47 PM, Charles Pritchard wrote:
>> On 4/11/2012 2:41 PM, Kenneth Russell wrote:
>>> On Wed, Apr 11, 2012 at 10:04 AM, Boris Zbarsky<bzbarsky@mit.edu> 
>>> wrote:
>>>> > Seems like right now passing a typed array to send() requires a bit
>>>> of extra
>>>> > hoop-jumping to pass the .buffer instead, right? Is that desirable?
>>> It may be convenient to add an overload to send() (presumably on both
>>> XHR and WebSocket? Any others?) accepting ArrayBufferView. As pointed
>>
>> It's convenient.
>>
>> xhr.send(view); // shorthand
>> xhr.send(view.buffer.slice(view.byteOffset,
>> view.byteOffset+view.byteLength)); // longhand.
>
> Note that those have different performance characteristics, too; the 
> latter involves a buffer copy.

Are we stuck with a buffer copy (or copy on write) mechanism anyway?

What is the spec on changing the buffer after xhr.send?

example:
xhr.send(bigView.buffer); bigView[0] = 255; bigView[10000000] = 255;
Received on Wednesday, 11 April 2012 21:54:22 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:51 GMT