Multithreading the downloadrequests

This commit is contained in:
Alexander Bock
2015-06-17 01:02:07 +02:00
parent 72c520e1d1
commit 850d9d3789
4 changed files with 84 additions and 12 deletions

View File

@@ -58,10 +58,12 @@ public:
typedef std::function<void(const FileFuture&)> DownloadProgressCallback;
typedef std::function<void(const FileFuture&)> DownloadFinishedCallback;
typedef std::function<void(const std::vector<FileFuture*>&)> AsyncDownloadFinishedCallback;
DownloadManager(std::string requestURL, int applicationVersion);
// callers responsibility to delete
// callbacks happen on a different thread
FileFuture* downloadFile(
const std::string& url,
const ghoul::filesystem::File& file,
@@ -82,6 +84,14 @@ public:
// TODO: Add async version of downloadRequestFiles that returns a filefuture
// that can be used to call an additional function
void downloadRequestFilesAsync(
const std::string& identifier,
const ghoul::filesystem::Directory& destination,
int version,
bool overrideFiles,
AsyncDownloadFinishedCallback callback
);
private:
std::string _requestURL;
int _applicationVersion;