W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: Is BlobBuilder needed?

From: Glenn Maynard <glenn@zewt.org>
Date: Thu, 27 Oct 2011 12:30:33 -0400
Message-ID: <CABirCh9GLdM8YyzAyL4Qb_V+VX0RaU5Ek6xjKZDY7sgUR-gkMQ@mail.gmail.com>
To: ATSUSHI TAKAYAMA <taka.atsushi@googlemail.com>
Cc: Webapps WG <public-webapps@w3.org>, Jonas Sicking <jonas@sicking.cc>
On Thu, Oct 27, 2011 at 11:51 AM, ATSUSHI TAKAYAMA <
taka.atsushi@googlemail.com> wrote:

> So converting Blob to ArrayBuffer is only supported through an
> asynchronous API (FileReader's readAsArrayBuffer) except in Workers,
> but the other way round is synchronous? I thought the direction of the
> client side web was to make all API's that might involve disk access
> asynchronous.
>

Creating a Blob can be synchronous because it doesn't actually (visibly)
copy or move any data around--that doesn't happen until you actually try to
do something with the data, and all APIs to do *that* are async.

Even if an implementation needs to hit the disk to make a Blob out of an
ArrayBuffer for some reason, it doesn't have to wait for that to complete
before returning the Blob.  It can just return the Blob and complete the
copy asynchronously, since it already knows everything it needs to about the
Blob (its size) in order to return it.

-- 
Glenn Maynard
Received on Thursday, 27 October 2011 16:31:03 GMT

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