Move WorkerTask functionality into RunLoop core
As a byproduct, this makes FileCache get requests properly cancelable.
This commit is contained in:
@@ -126,12 +126,12 @@ void SQLiteCache::Impl::createSchema() {
|
||||
}
|
||||
}
|
||||
|
||||
void SQLiteCache::get(const Resource &resource, Callback callback) {
|
||||
std::unique_ptr<WorkRequest> SQLiteCache::get(const Resource &resource, Callback callback) {
|
||||
// Can be called from any thread, but most likely from the file source thread.
|
||||
// Will try to load the URL from the SQLite database and call the callback when done.
|
||||
// Note that the callback is probably going to invoked from another thread, so the caller
|
||||
// must make sure that it can run in that thread.
|
||||
thread->invokeWithResult(&Impl::get, std::move(callback), resource);
|
||||
return thread->invokeWithResult(&Impl::get, std::move(callback), resource);
|
||||
}
|
||||
|
||||
std::unique_ptr<Response> SQLiteCache::Impl::get(const Resource &resource) {
|
||||
|
||||
Reference in New Issue
Block a user