Open Bug 490714 (placesFolders) Opened 11 years ago Updated 1 year ago
Asynchronous API for opening container query nodes
containerNode.openContainerAsync(function () alert("Container opened!")); Like that. By asynchronous I mean that the SQL query underneath the container is asynchronous, using the async storage API. This won't make the entire batch of container children load any faster, but it does mean Firefox won't beachball while the SQL is blocking the UI and everything else. There may be opportunities for the callback to be notified of chunks of children as they're loaded, but this is complicated where we're sorting children in C++ only after obtaining all SQL results. The most obvious use case in the front end is the Places tree view, especially in the library. (Searches in the library should benefit, too.) I'm imagining an animated throbber on top of the whole tree as the children of its root container are loaded, and throbbers in individual container rows as their children are loaded. UI feedback like this should pretty simple via CSS. Fortunately there's an existing nsINavHistoryResultViewer interface that the tree view uses to observe container openings and closings, and so I think the tree view could be made to use the async API without quite as much trouble as one might first think. Perhaps this interface could be used everywhere in lieu of a callback function. Will attach a WIP patch that begins the API and the tree view's use of it after I clean it up a little.
Very much a WIP. Includes the patch to bug 490867, which blocks this bug and the test requires to pass. Also includes a stab at updating the tree view. (Of course this portion will be broken out into a different bug later on. Currently the tree view busy waits on the new container node attribute containerOpening.) Need to look at all the places where sync and async openings could intersect and screw each other up, but working on the tree view simultaneously has been a help so far, and this patch prevents some basic interactions between the two.
Priority: -- → P1
Please consider adding the ability to cancel asynchronous queries. It would also be very useful in an extension which I have written, and probably useful also in the library and in other occasions.
Whiteboard: [Snappy:P3] [fxperf] → [Snappy:P3] [fxperf:p3]
You need to log in before you can comment on or make changes to this bug.