On Tue, Sep 1, 2009 at 5:59 PM, Markitusss<[email protected]> wrote: > OpenDataBase default to Async DB transactions. Currently, > OpenDataBaseSync method throws "not found" on Global etc... > > Is this going to be implemented?
No. Per the HTML5 spec, synchronous database access is not supported on the UI thread in Chromium, for both normal webpages and for extensions. This is done to avoid blocking the web page's responsiveness on potentially long-running database operations. > If not, how can I simulate a Sync behavior with the default Async? I > tried several approaches but the single threaded javascript behavior > always locks the UI. It is not possible to simulate synchronous APIs on top of an async API without some form of blocking wait, which is not available in JavaScript, for the same reasons as above -- it would lead to blocking the web page's responsiveness. > In my extension I have a 3 layer architecture, so I don;t want to > implement a callback-based solution for every DAO call. > > What do you suggest? JavaScript in web pages (and extensions) is a fundamentally single-threaded, event-driven environment. Asynchronous callbacks are the nature of the beast, learn to love them :-/. Another approach that isn't available yet, but will be someday, is to use a web worker: http://www.whatwg.org/specs/web-workers/current-work/ Web workers are entirely separate JS environments running on separate threads. Synchronous database access is supported in web workers. I'm not sure what the current status of workers and worker+databases and workers+databases+extensions is in Chromium, but I wouldn't expect them to all work together flawlessly ;-). But as the three systems mature, this should eventually be an option for you. - a --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Chromium-extensions" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/chromium-extensions?hl=en -~----------~----~----~----~------~----~------~--~---
