| 858 | } |
| 859 | |
| 860 | void DownloaderCURL::_onUpdate(float) |
| 861 | { |
| 862 | std::vector<std::shared_ptr<DownloadTask>> tasks; |
| 863 | |
| 864 | // update processing tasks |
| 865 | _impl->getProcessTasks(tasks); |
| 866 | for (auto&& task : tasks) |
| 867 | { |
| 868 | auto context = static_cast<DownloadContextCURL*>(task->_context.get()); |
| 869 | std::lock_guard<std::recursive_mutex> lock(context->_mutex); |
| 870 | if (context->_bytesReceived) |
| 871 | { |
| 872 | _updateTaskProgressInfo(*task); |
| 873 | onTaskProgress(*task); |
| 874 | context->_bytesReceived = 0; |
| 875 | } |
| 876 | } |
| 877 | tasks.clear(); |
| 878 | |
| 879 | // update finished tasks |
| 880 | _impl->getFinishedTasks(tasks); |
| 881 | if (_impl->stopped()) |
| 882 | { |
| 883 | if (_scheduler) |
| 884 | _scheduler->pauseTarget(this); |
| 885 | } |
| 886 | |
| 887 | for (auto&& task : tasks) |
| 888 | { |
| 889 | _onDownloadFinished(*task); |
| 890 | } |
| 891 | } |
| 892 | |
| 893 | void DownloaderCURL::_updateTaskProgressInfo(DownloadTask& task, int64_t totalExpected) |
| 894 | { |
nothing calls this directly
no test coverage detected