mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 23:26:25 +02:00
Android - Add a clear method on pending downloads and use it when going background
This commit is contained in:
parent
227bd1487e
commit
3837952418
3 changed files with 15 additions and 0 deletions
|
@ -8271,6 +8271,10 @@ void Application::enterBackground() {
|
|||
if (getActiveDisplayPlugin()->isActive()) {
|
||||
getActiveDisplayPlugin()->deactivate();
|
||||
}
|
||||
// Clear caches
|
||||
clearDomainOctreeDetails();
|
||||
// Clear the pending request list to avoid extra downloads to happen
|
||||
ResourceCache::clearPendingRequests();
|
||||
}
|
||||
|
||||
void Application::enterForeground() {
|
||||
|
|
|
@ -95,6 +95,11 @@ void ResourceCacheSharedItems::removeRequest(QWeakPointer<Resource> resource) {
|
|||
}
|
||||
}
|
||||
|
||||
void ResourceCacheSharedItems::clearPendingRequests() {
|
||||
Lock lock(_mutex);
|
||||
_pendingRequests.clear();
|
||||
}
|
||||
|
||||
QSharedPointer<Resource> ResourceCacheSharedItems::getHighestPendingRequest() {
|
||||
// look for the highest priority pending request
|
||||
int highestIndex = -1;
|
||||
|
@ -467,6 +472,10 @@ int ResourceCache::getPendingRequestCount() {
|
|||
return DependencyManager::get<ResourceCacheSharedItems>()->getPendingRequestsCount();
|
||||
}
|
||||
|
||||
void ResourceCache::clearPendingRequests() {
|
||||
return DependencyManager::get<ResourceCacheSharedItems>()->clearPendingRequests();
|
||||
}
|
||||
|
||||
int ResourceCache::getLoadingRequestCount() {
|
||||
return DependencyManager::get<ResourceCacheSharedItems>()->getLoadingRequestsCount();
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ public:
|
|||
void removeRequest(QWeakPointer<Resource> doneRequest);
|
||||
QList<QSharedPointer<Resource>> getPendingRequests();
|
||||
uint32_t getPendingRequestsCount() const;
|
||||
void clearPendingRequests();
|
||||
QList<QSharedPointer<Resource>> getLoadingRequests();
|
||||
QSharedPointer<Resource> getHighestPendingRequest();
|
||||
uint32_t getLoadingRequestsCount() const;
|
||||
|
@ -225,6 +226,7 @@ public:
|
|||
static QList<QSharedPointer<Resource>> getLoadingRequests();
|
||||
|
||||
static int getPendingRequestCount();
|
||||
static void clearPendingRequests();
|
||||
|
||||
static int getLoadingRequestCount();
|
||||
|
||||
|
|
Loading…
Reference in a new issue