W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2009

[whatwg] localStorage + worker processes

From: Aaron Boodman <aa@google.com>
Date: Sat, 21 Mar 2009 09:38:35 -0700
Message-ID: <278fd46c0903210938o77f076f8v108f2bf40d8167f8@mail.gmail.com>
On Sat, Mar 21, 2009 at 12:48 AM, Jonas Sicking <jonas at sicking.cc> wrote:
> What we could do, is to have an API like
>
> getLocalStorage(callback);
>
> This function returns immediately, but will then call the callback
> function as soon as the localStorage becomes available and the lock
> been acquired. This would always happen asynchronously off the event
> loop, which means that once the callback returns the lock is released
> again.

Funny, a few of us from Chromium were discussing a similar solution privately.

Actually, I don't believe that it is required that the callback run
asynchronously. All the callback is used for is establishing the lock
lifetime explicitly, and we assume that this will usually make the
lock lifetime short. So we can block while we wait for it to become
available. This is just like the behavior today without workers.

> This new API I believe is good enough to be used both from workers and
> window contexts.

We could maintain backward compatibility by not making it required on
normal web pages, because our assumption has been that web pages won't
hold the lock for long periods of time (because they wouldn't want to
block the UI either).

- a
Received on Saturday, 21 March 2009 09:38:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:47:49 GMT