From e2d8d820964f39a58f20fc2477a83867e9297209 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 30 Mar 2015 16:34:04 -0700 Subject: [PATCH] more script caching cleanup --- .../src/EntityTreeRenderer.cpp | 16 ---- libraries/script-engine/src/Script.cpp | 49 ---------- libraries/script-engine/src/Script.h | 37 -------- libraries/script-engine/src/ScriptCache.cpp | 91 +------------------ libraries/script-engine/src/ScriptCache.h | 9 +- libraries/script-engine/src/ScriptEngine.cpp | 23 ----- libraries/script-engine/src/ScriptEngine.h | 2 - 7 files changed, 2 insertions(+), 225 deletions(-) delete mode 100644 libraries/script-engine/src/Script.cpp delete mode 100644 libraries/script-engine/src/Script.h diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 39b26e9598..251992ffe9 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -165,22 +165,6 @@ QString EntityTreeRenderer::loadScriptContents(const QString& scriptMaybeURLorTe qDebug() << "ERROR Loading file:" << fileName; } } else { - /* - QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); - QNetworkRequest networkRequest = QNetworkRequest(url); - networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT); - QNetworkReply* reply = networkAccessManager.get(networkRequest); - qDebug() << "Downloading script at" << url; - QEventLoop loop; - QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); - loop.exec(); - if (reply->error() == QNetworkReply::NoError && reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) == 200) { - scriptContents = reply->readAll(); - } else { - qDebug() << "ERROR Loading file:" << url.toString(); - } - delete reply; - */ auto scriptCache = DependencyManager::get(); scriptContents = scriptCache->getScript(url, this, isPending); } diff --git a/libraries/script-engine/src/Script.cpp b/libraries/script-engine/src/Script.cpp deleted file mode 100644 index 4f5d38a2e1..0000000000 --- a/libraries/script-engine/src/Script.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -// Script.cpp -// libraries/script-engine/src -// -// Created by Brad Hefta-Gaub on 2015-03-30 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -/* -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "AudioRingBuffer.h" -#include "AudioFormat.h" -#include "AudioBuffer.h" -#include "AudioEditBuffer.h" -*/ - -#include "Script.h" - -Script::Script(const QUrl& url) : - Resource(url), - _isReady(false) -{ - -} - -void Script::downloadFinished(QNetworkReply* reply) { - // replace our byte array with the downloaded data - _contents = reply->readAll(); - qDebug() << "Script downloaded from:" << getURL(); - _isReady = true; - reply->deleteLater(); -} - diff --git a/libraries/script-engine/src/Script.h b/libraries/script-engine/src/Script.h deleted file mode 100644 index 6cca76a8e8..0000000000 --- a/libraries/script-engine/src/Script.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// Script.h -// libraries/script-engine/src -// -// Created by Brad Hefta-Gaub on 2015-03-30 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#ifndef hifi_Script_h -#define hifi_Script_h - -#include -#include -#include - -#include - -class Script : public Resource { - Q_OBJECT -public: - Script(const QUrl& url); - bool isReady() const { return _isReady; } - const QString& getContents() { return _contents; } - -private: - QString _contents; - bool _isReady; - - virtual void downloadFinished(QNetworkReply* reply); -}; - -typedef QSharedPointer