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

Re: Is BlobBuilder needed?

From: Glenn Maynard <glenn@zewt.org>
Date: Mon, 24 Oct 2011 22:56:27 -0400
Message-ID: <CABirCh96u4rJDw+RjFr33Q_6ugawe1tDXQw+4u4yAPZEPMV4Lw@mail.gmail.com>
To: Erik Arvidsson <arv@chromium.org>
Cc: Jonas Sicking <jonas@sicking.cc>, Ojan Vafai <ojan@chromium.org>, "Tab Atkins Jr." <jackalmage@gmail.com>, Eric U <ericu@google.com>, Webapps WG <public-webapps@w3.org>
On Mon, Oct 24, 2011 at 10:49 PM, Erik Arvidsson <arv@chromium.org> wrote:

> I think the point is that with the old one you could generate lots of
> data, add that to the blob, generate a lot more data and add that to
> the blob. After every add it might be safe to gc that data. With this
> proposal all that data needs to be in memory at the point of
> construction.
>

It doesn't.  Each individual "low-level" Blob can be swapped to disk, and
stay there; you don't need to read it into memory to construct new Blobs
containing it.

Repeating my earlier example:

var b = new Blob();
ongotdataevent = function(blobToAppend) { b = new Blob(b, blobToAppend); }

You don't need to have any of the previous Blobs in memory when you create
each new compound Blob; you only need to know where to get them later, and
their size.



> Could we add a concat like method to Blob that returns a new "larger" blob?
>
> var bb = new BlobBuilder();
> bb.append(data);
> bb.append(moreData);
> var b = bb.getBlob();
>

This is the same as the above: new Blob(data, moreData).  There's no need
for a special method for this.

-- 
Glenn Maynard
Received on Tuesday, 25 October 2011 02:56:56 GMT

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