[WebKit-devel] RFC: API for KWebWallet...
David Faure
faure at kde.org
Mon Nov 9 12:56:34 CET 2009
On Friday 06 November 2009, Dawit A. wrote:
> It can be implemented using QFuture. It would simply mean that this class
> defers the decision and the work of whether or not the call should be async
> or not to the caller itself. In other words, the caller can choose to
> call result() on what the saveFormData function returns and block waiting
> for the result or it can choose to use QFutureWatcher and become
> non-blocking. Of course, QFutureWatcher uses signals/slots.
I understand the API idea, but I don't understand how you can implement it.
What will you write in the implementation of
QFuture<bool> KWebWallet::saveFormData(QWebFrame* frame)
{
QFuture<bool> myfuture;
// what here ???
return myfuture;
}
QFuture has no virtual methods, and the only thing that seems to create
QFutures in Qt is QtConcurrent::run. So what would you write in there,
that doesn't use a thread?
Either I'm missing something (and then I apologize), or this whole idea does
not work, because QFuture is only meant for threads.
And if we're not talking about threads, then implementing "blocking on top of
async" means nested event loop, which means unexpected reentrancy, which means
bugs and crashes, which I don't really recommend.
--
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).
More information about the WebKit-devel
mailing list