[webkit-dev] Database in Worker context

Eric Uhrhane ericu at chromium.org
Wed Dec 9 12:58:26 PST 2009

Hello webkit folks!

This is just a heads-up that I'm working on implementing access to the
SQL database from worker context [I see
https://bugs.webkit.org/show_bug.cgi?id=22725, now that I look for
it].  I'll give a quick outline as to how I'm doing it, and if you
want to tell me that there's a better way to do it, or that this is a
bad idea, I'm all ears.  I'm starting off doing just the asynchronous
API, but plan to move on to the synchronous API when that's done.  I'm
doing my initial implementation in Chrome for testing purposes
[especially thread/process issues], but when I'm ready to check in,
it'll go into webkit first.

What I'm doing:

I've pulled the database-related members out of Document and made a
new class for them, DatabaseManager.  An instance of that is owned by
each ScriptExecutionContext.  There are two flavors,
DocumentDatabaseManager and WorkerDatabaseManager.  They're not very
different, but in a few cases it was necessary to distinguish between
them, as for example there's no way to get from a worker's database to
a Document.  Because of that, there are a few things I haven't figured
out how to handle cleanly yet [quota exceptions, inspector access],
but having separate subclasses lets me get in a bunch of new
functionality without breaking the existing code.

That's it, really--it's changes to a few dozen files, about half of
them in the JavaScript bindings, but it's really only a few lines of
change in each file for most of them.  I hope to have some code to
show you shortly, and will port the existing Database layout tests to
Workers in order to test it.


More information about the webkit-dev mailing list