History

make ResourceManager be owned by DependencyManager

Seth Alves committed 9 years ago

Commit 794495c1 parent 561786023 files · +68 −65Browse files

Showing the changes to libraries/script-engine/src/ScriptCache.cpp (1 of 23 files). Show all

Unified · Split

libraries/script-engine/src/ScriptCache.cpp+4−4
@@ -57,7 +57,7 @@ void ScriptCache::clearATPScriptsFromCache() { · 56 unmodified lines
57}57}
58 58
59void ScriptCache::deleteScript(const QUrl& unnormalizedURL) {59void ScriptCache::deleteScript(const QUrl& unnormalizedURL) {
60 QUrl url = ResourceManager::normalizeURL(unnormalizedURL);60 QUrl url = DependencyManager::get<ResourceManager>()->normalizeURL(unnormalizedURL);
61 Lock lock(_containerLock);61 Lock lock(_containerLock);
62 if (_scriptCache.contains(url)) {62 if (_scriptCache.contains(url)) {
63 qCDebug(scriptengine) << "Delete script from cache:" << url.toString();63 qCDebug(scriptengine) << "Delete script from cache:" << url.toString();
@@ -70,7 +70,7 @@ void ScriptCache::getScriptContents(const QString& scriptOrURL, contentAvailable · 6 unmodified lines
70 qCDebug(scriptengine) << "ScriptCache::getScriptContents() on thread [" << QThread::currentThread() << "] expected thread [" << thread() << "]";70 qCDebug(scriptengine) << "ScriptCache::getScriptContents() on thread [" << QThread::currentThread() << "] expected thread [" << thread() << "]";
71 #endif71 #endif
72 QUrl unnormalizedURL(scriptOrURL);72 QUrl unnormalizedURL(scriptOrURL);
73 QUrl url = ResourceManager::normalizeURL(unnormalizedURL);73 QUrl url = DependencyManager::get<ResourceManager>()->normalizeURL(unnormalizedURL);
74 74
75 // attempt to determine if this is a URL to a script, or if this is actually a script itself (which is valid in the75 // attempt to determine if this is a URL to a script, or if this is actually a script itself (which is valid in the
76 // entityScript use case)76 // entityScript use case)
@@ -109,7 +109,7 @@ void ScriptCache::getScriptContents(const QString& scriptOrURL, contentAvailable · 32 unmodified lines
109 #ifdef THREAD_DEBUGGING109 #ifdef THREAD_DEBUGGING
110 qCDebug(scriptengine) << "about to call: ResourceManager::createResourceRequest(this, url); on thread [" << QThread::currentThread() << "] expected thread [" << thread() << "]";110 qCDebug(scriptengine) << "about to call: ResourceManager::createResourceRequest(this, url); on thread [" << QThread::currentThread() << "] expected thread [" << thread() << "]";
111 #endif111 #endif
112 auto request = ResourceManager::createResourceRequest(nullptr, url);112 auto request = DependencyManager::get<ResourceManager>()->createResourceRequest(nullptr, url);
113 Q_ASSERT(request);113 Q_ASSERT(request);
114 request->setCacheEnabled(!forceDownload);114 request->setCacheEnabled(!forceDownload);
115 connect(request, &ResourceRequest::finished, this, [=]{ scriptContentAvailable(maxRetries); });115 connect(request, &ResourceRequest::finished, this, [=]{ scriptContentAvailable(maxRetries); });
@@ -166,7 +166,7 @@ void ScriptCache::scriptContentAvailable(int maxRetries) { · 50 unmodified lines
166 qCDebug(scriptengine) << QString("Retrying script request [%1 / %2]: %3")166 qCDebug(scriptengine) << QString("Retrying script request [%1 / %2]: %3")
167 .arg(attempt).arg(maxRetries).arg(url.toString());167 .arg(attempt).arg(maxRetries).arg(url.toString());
168 168
169 auto request = ResourceManager::createResourceRequest(nullptr, url);169 auto request = DependencyManager::get<ResourceManager>()->createResourceRequest(nullptr, url);
170 Q_ASSERT(request);170 Q_ASSERT(request);
171 171
172 // We've already made a request, so the cache must be disabled or it wasn't there, so enabling172 // We've already made a request, so the cache must be disabled or it wasn't there, so enabling