Re: [webkit-dev] Web SQL Database API - openDatabaseSync

2010-07-08 Thread Evan Ireland
Dmitry,

The asynchronous API makes composition much more difficult. Like if we
generate code that wraps the database API into business objects, all the
business object methods need to accept callback parameters.

Suppose I want to show an employee together with their department name, I
could write:

function formatEmployee(e)
{
return e.getName() + ,  + e.getDepartment().getName();
}
alert(formatEmployee(Employee.find(123));

Forgive my using alert, just for the purpose of example.

Now suppose that e.getDepartment() call (child to parent navigation) needs
to be asynchronous due to lazy loading.

Now I need something like:

function formatEmployee(e, success, failure)
{
e.getDepartment
(
function(d)
{
success(e.getName() + ,  + d.getName());
},
failure
);
}
Employee.find
(
123,
function(e)
{
formatEmployee
(
e,
function(s) { alert(s); },
function() { /* ignore failure */ }
)
},
function() { /* ignore failure */ }
);

Is soon gets very nasty. I do appreciate how to program in a
continuation-passing style, which can be easier with good language support
(e.g. Haskell). But just imagine if the '+' operator was asynchronous, how
much more trouble ordinary programming would be.

In any case, I can accept that using synchronous DB API in the UI thread
could be considered undesirable.
Using it from a worker thread however is essential. To get good
composability, I might wish to run business objects in a worker thread using
a synchronous API rather than using an asynchronous API from the UI thread.

I hope this helps to clarify where I am coming from with my questions.

-Original Message-
From: Dmitry Titov [mailto:dim...@google.com] 
Sent: Thursday, July 08, 2010 2:27 PM
To: Evan Ireland
Cc: Andrei Popescu; Eric Uhrhane; webkit-dev@lists.webkit.org
Subject: Re: [webkit-dev] Web SQL Database API - openDatabaseSync

On Tue, Jul 6, 2010 at 10:00 AM, Evan Ireland eirel...@sybase.com wrote:

 Andrei,

 On page:

  http://www.ibm.com/developerworks/library/x-html5mobile4/

 I see:

  Starting with Android 2.0, the Android browser has had full support for
 the HTML 5 Web Worker specification.

 Is the quoted page incorrect about Web Workers on Android? (It seems to
 contradict what you wrote below).

 I was hoping to do some prototyping with Web Workers and Google Gears on
 Android until such time as the sync database API is available. But perhaps
 I
 will need to limit testing to desktop Chrome for the moment.


I'd be curious what benefit the synchronous version of API gives? Isn't it
useful to keep even the workers responsive to PostMessage from UI thread, as
opposite to accumulating a ton of posted messages and then receiving them in
a rapid-fire in the worker after a sync API returns? What if it never
returns (the database is locked or who knows)? I don't know what you are
building of course, but using async code everywhere doesn't look like a
terrible choice. Or does it? :-) Just curious.




 -Original Message-
 From: Andrei Popescu [mailto:andr...@google.com]
 Sent: Friday, July 02, 2010 3:54 AM
 To: Eric Uhrhane
 Cc: Evan Ireland; webkit-dev@lists.webkit.org
 Subject: Re: [webkit-dev] Web SQL Database API - openDatabaseSync

 Hi,

 On Fri, Jul 2, 2010 at 2:40 AM, Eric Uhrhane er...@google.com wrote:
  I doubt that it's been pushed to any Android phone yet.  It only went
  into webkit in the past couple of months, and there's a bit of lag as
  they incorporate new code.  You'd have to ask Android folks when they
  plan to ship it.
 

 Async Web SQL Database is available on Android since version 2.0.

 Sync Web SQL Database and Web Workers are not currently available on
 Android (not even on 2.2).

 Thanks,
 Andrei


 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Web SQL Database API - openDatabaseSync

2010-07-06 Thread Evan Ireland
Andrei,

On page:

  http://www.ibm.com/developerworks/library/x-html5mobile4/

I see:

  Starting with Android 2.0, the Android browser has had full support for
the HTML 5 Web Worker specification.

Is the quoted page incorrect about Web Workers on Android? (It seems to
contradict what you wrote below).

I was hoping to do some prototyping with Web Workers and Google Gears on
Android until such time as the sync database API is available. But perhaps I
will need to limit testing to desktop Chrome for the moment.

-Original Message-
From: Andrei Popescu [mailto:andr...@google.com] 
Sent: Friday, July 02, 2010 3:54 AM
To: Eric Uhrhane
Cc: Evan Ireland; webkit-dev@lists.webkit.org
Subject: Re: [webkit-dev] Web SQL Database API - openDatabaseSync

Hi,

On Fri, Jul 2, 2010 at 2:40 AM, Eric Uhrhane er...@google.com wrote:
 I doubt that it's been pushed to any Android phone yet.  It only went
 into webkit in the past couple of months, and there's a bit of lag as
 they incorporate new code.  You'd have to ask Android folks when they
 plan to ship it.


Async Web SQL Database is available on Android since version 2.0.

Sync Web SQL Database and Web Workers are not currently available on
Android (not even on 2.2).

Thanks,
Andrei


___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Web SQL Database API - openDatabaseSync

2010-07-02 Thread Andrei Popescu
Hi,

On Fri, Jul 2, 2010 at 2:40 AM, Eric Uhrhane er...@google.com wrote:
 I doubt that it's been pushed to any Android phone yet.  It only went
 into webkit in the past couple of months, and there's a bit of lag as
 they incorporate new code.  You'd have to ask Android folks when they
 plan to ship it.


Async Web SQL Database is available on Android since version 2.0.

Sync Web SQL Database and Web Workers are not currently available on
Android (not even on 2.2).

Thanks,
Andrei
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


[webkit-dev] Web SQL Database API - openDatabaseSync

2010-07-01 Thread Evan Ireland
Does anyone have an implementation of the synchronous SQL Database API
(openDatabaseSync...)?

If so, is it usable from the main UI (non-worker) browser thread?

If not, does anyone have an ETA on availability of the synchronous API
usable from the main UI thread.

Thanks.

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Web SQL Database API - openDatabaseSync

2010-07-01 Thread Eric Uhrhane
On Thu, Jul 1, 2010 at 2:07 PM, Evan Ireland eirel...@sybase.com wrote:
 Does anyone have an implementation of the synchronous SQL Database API
 (openDatabaseSync...)?

Not as far as I know, but Dumi will have one completed in [webkit and
chrome] shortly.

 If so, is it usable from the main UI (non-worker) browser thread?

No, by design, that API is only accessable from worker context.  In
the document context you have to use the asynchronous API [which is
currently available on worker threads in webkit and chromium].

 If not, does anyone have an ETA on availability of the synchronous API
 usable from the main UI thread.

It's not likely that anyone will implement this, as it's a) not in the
spec; b) guaranteed to cause awkward lockups of the whole UI.

 Eric
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Web SQL Database API - openDatabaseSync

2010-07-01 Thread Evan Ireland
Eric,

Thanks.

One more question if you don't mind. Is the async version of SQL Database
API and worker thread support available in a version of webkit that is
generally available on Android-based smartphones?

-Original Message-
From: Eric Uhrhane [mailto:er...@google.com] 
Sent: Friday, 2 July 2010 9:53 a.m.
To: Evan Ireland
Cc: webkit-dev@lists.webkit.org
Subject: Re: [webkit-dev] Web SQL Database API - openDatabaseSync

On Thu, Jul 1, 2010 at 2:07 PM, Evan Ireland eirel...@sybase.com wrote:
 Does anyone have an implementation of the synchronous SQL Database API
 (openDatabaseSync...)?

Not as far as I know, but Dumi will have one completed in [webkit and
chrome] shortly.

 If so, is it usable from the main UI (non-worker) browser thread?

No, by design, that API is only accessable from worker context.  In
the document context you have to use the asynchronous API [which is
currently available on worker threads in webkit and chromium].

 If not, does anyone have an ETA on availability of the synchronous API
 usable from the main UI thread.

It's not likely that anyone will implement this, as it's a) not in the
spec; b) guaranteed to cause awkward lockups of the whole UI.

 Eric

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Web SQL Database API - openDatabaseSync

2010-07-01 Thread Eric Uhrhane
I doubt that it's been pushed to any Android phone yet.  It only went
into webkit in the past couple of months, and there's a bit of lag as
they incorporate new code.  You'd have to ask Android folks when they
plan to ship it.

On Thu, Jul 1, 2010 at 6:38 PM, Evan Ireland eirel...@sybase.com wrote:
 Eric,

 Thanks.

 One more question if you don't mind. Is the async version of SQL Database
 API and worker thread support available in a version of webkit that is
 generally available on Android-based smartphones?

 -Original Message-
 From: Eric Uhrhane [mailto:er...@google.com]
 Sent: Friday, 2 July 2010 9:53 a.m.
 To: Evan Ireland
 Cc: webkit-dev@lists.webkit.org
 Subject: Re: [webkit-dev] Web SQL Database API - openDatabaseSync

 On Thu, Jul 1, 2010 at 2:07 PM, Evan Ireland eirel...@sybase.com wrote:
 Does anyone have an implementation of the synchronous SQL Database API
 (openDatabaseSync...)?

 Not as far as I know, but Dumi will have one completed in [webkit and
 chrome] shortly.

 If so, is it usable from the main UI (non-worker) browser thread?

 No, by design, that API is only accessable from worker context.  In
 the document context you have to use the asynchronous API [which is
 currently available on worker threads in webkit and chromium].

 If not, does anyone have an ETA on availability of the synchronous API
 usable from the main UI thread.

 It's not likely that anyone will implement this, as it's a) not in the
 spec; b) guaranteed to cause awkward lockups of the whole UI.

     Eric


___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev