W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2012

Re: [FileAPI] Deterministic release of Blob proposal

From: Glenn Maynard <glenn@zewt.org>
Date: Mon, 5 Mar 2012 17:59:03 -0600
Message-ID: <CABirCh-aHOG02kD781zsC9xnDWnfqbBggQzmq2JiKwyYxZRRNQ@mail.gmail.com>
To: Feras Moussa <ferasm@microsoft.com>
Cc: "public-webapps@w3.org" <public-webapps@w3.org>, Adrian Bateman <adrianba@microsoft.com>
On Fri, Mar 2, 2012 at 6:54 PM, Feras Moussa <ferasm@microsoft.com> wrote:

> To address this issue, we propose that a close method be added to the Blob
> ****
>
> interface.****
>
> When called, the close method should release the underlying resource of
> the ****
>
> Blob, and future operations on the Blob will return a new error, a
> ClosedError. ****
>
> This allows an application to signal when it's finished using the Blob.
>

This is exactly like the "neuter" concept, defined at
http://dev.w3.org/html5/spec/common-dom-interfaces.html#transferable-objects.
I recommend using it.  Make Blob a Transferable, and have close() neuter
the object.  The rest of this wouldn't change much, except you'd say "if
the object has been neutered" (or "has the neutered flag set", or however
it's defined) instead of "if the close method has been called".

Originally, I think it was assumed that Blobs don't need to be
Transferable, because they're immutable, which means you don't
(necessarily) need to make a copy when transferring them between threads.
That was only considering the cost of copying the Blob, though, not the
costs of delayed GC that you're talking about here, so I think transferable
Blobs do make sense.

Also, the close() method should probably go on Transferable (with a name
less likely to clash, eg. "neuter"), instead of as a one-off on Blob.  If
it's useful for Blob, it's probably useful for ArrayBuffer and all other
future Transferables as well.

-- 
Glenn Maynard
Received on Monday, 5 March 2012 23:59:31 GMT

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