History

Remove unused ScriptEngine::_wantSignals

Zach Pomerantz committed 10 years ago

Commit 820fdf01 parent 8fecb513 files · +24 −55Browse files

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

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+22−50
@@ -138,10 +138,9 @@ static bool hadUncaughtExceptions(QScriptEngine& engine, const QString& fileName · 137 unmodified lines
138 return false;138 return false;
139}139}
140 140
141ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNameString, bool wantSignals) :141ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNameString) :
142 _scriptContents(scriptContents),142 _scriptContents(scriptContents),
143 _timerFunctionMap(),143 _timerFunctionMap(),
144 _wantSignals(wantSignals),
145 _fileNameString(fileNameString),144 _fileNameString(fileNameString),
146 _arrayBufferClass(new ArrayBufferClass(this))145 _arrayBufferClass(new ArrayBufferClass(this))
147{146{
@@ -231,15 +230,14 @@ void ScriptEngine::runDebuggable() { · 83 unmodified lines
231 return;230 return;
232 }231 }
233 stopAllTimers(); // make sure all our timers are stopped if the script is ending232 stopAllTimers(); // make sure all our timers are stopped if the script is ending
234 if (_wantSignals) {233
235 emit scriptEnding();234 emit scriptEnding();
236 emit finished(_fileNameString, this);235 emit finished(_fileNameString, this);
237 }
238 _isRunning = false;236 _isRunning = false;
239 if (_wantSignals) {237
240 emit runningStateChanged();238 emit runningStateChanged();
241 emit doneRunning();239 emit doneRunning();
242 }240
243 timer->deleteLater();241 timer->deleteLater();
244 return;242 return;
245 }243 }
@@ -249,9 +247,7 @@ void ScriptEngine::runDebuggable() { · 3 unmodified lines
249 if (_lastUpdate < now) {247 if (_lastUpdate < now) {
250 float deltaTime = (float)(now - _lastUpdate) / (float)USECS_PER_SECOND;248 float deltaTime = (float)(now - _lastUpdate) / (float)USECS_PER_SECOND;
251 if (!_isFinished) {249 if (!_isFinished) {
252 if (_wantSignals) {250 emit update(deltaTime);
253 emit update(deltaTime);
254 }
255 }251 }
256 }252 }
257 _lastUpdate = now;253 _lastUpdate = now;
@@ -358,17 +354,13 @@ void ScriptEngine::scriptContentsAvailable(const QUrl& url, const QString& scrip · 100 unmodified lines
358 if (QRegularExpression(DEBUG_FLAG).match(scriptContents).hasMatch()) {354 if (QRegularExpression(DEBUG_FLAG).match(scriptContents).hasMatch()) {
359 _debuggable = true;355 _debuggable = true;
360 }356 }
361 if (_wantSignals) {357 emit scriptLoaded(url.toString());
362 emit scriptLoaded(url.toString());
363 }
364}358}
365 359
366// FIXME - switch this to the new model of ScriptCache callbacks360// FIXME - switch this to the new model of ScriptCache callbacks
367void ScriptEngine::errorInLoadingScript(const QUrl& url) {361void ScriptEngine::errorInLoadingScript(const QUrl& url) {
368 qCDebug(scriptengine) << "ERROR Loading file:" << url.toString() << "line:" << __LINE__;362 qCDebug(scriptengine) << "ERROR Loading file:" << url.toString() << "line:" << __LINE__;
369 if (_wantSignals) {363 emit errorLoadingScript(_fileNameString); // ??
370 emit errorLoadingScript(_fileNameString); // ??
371 }
372}364}
373 365
374// Even though we never pass AnimVariantMap directly to and from javascript, the queued invokeMethod of366// Even though we never pass AnimVariantMap directly to and from javascript, the queued invokeMethod of
@@ -785,9 +777,7 @@ QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fi · 410 unmodified lines
785 --_evaluatesPending;777 --_evaluatesPending;
786 778
787 const auto hadUncaughtException = hadUncaughtExceptions(*this, program.fileName());779 const auto hadUncaughtException = hadUncaughtExceptions(*this, program.fileName());
788 if (_wantSignals) {780 emit evaluationFinished(result, hadUncaughtException);
789 emit evaluationFinished(result, hadUncaughtException);
790 }
791 return result;781 return result;
792}782}
793 783
@@ -801,9 +791,7 @@ void ScriptEngine::run() { · 7 unmodified lines
801 }791 }
802 792
803 _isRunning = true;793 _isRunning = true;
804 if (_wantSignals) {794 emit runningStateChanged();
805 emit runningStateChanged();
806 }
807 795
808 QScriptValue result = evaluate(_scriptContents, _fileNameString);796 QScriptValue result = evaluate(_scriptContents, _fileNameString);
809 797
@@ -872,9 +860,7 @@ void ScriptEngine::run() { · 62 unmodified lines
872 if (_lastUpdate < now) {860 if (_lastUpdate < now) {
873 float deltaTime = (float) (now - _lastUpdate) / (float) USECS_PER_SECOND;861 float deltaTime = (float) (now - _lastUpdate) / (float) USECS_PER_SECOND;
874 if (!_isFinished) {862 if (!_isFinished) {
875 if (_wantSignals) {863 emit update(deltaTime);
876 emit update(deltaTime);
877 }
878 }864 }
879 }865 }
880 _lastUpdate = now;866 _lastUpdate = now;
@@ -884,9 +870,7 @@ void ScriptEngine::run() { · 3 unmodified lines
884 }870 }
885 871
886 stopAllTimers(); // make sure all our timers are stopped if the script is ending872 stopAllTimers(); // make sure all our timers are stopped if the script is ending
887 if (_wantSignals) {873 emit scriptEnding();
888 emit scriptEnding();
889 }
890 874
891 if (entityScriptingInterface->getEntityPacketSender()->serversExist()) {875 if (entityScriptingInterface->getEntityPacketSender()->serversExist()) {
892 // release the queue of edit entity messages.876 // release the queue of edit entity messages.
@@ -904,15 +888,11 @@ void ScriptEngine::run() { · 11 unmodified lines
904 }888 }
905 }889 }
906 890
907 if (_wantSignals) {891 emit finished(_fileNameString, this);
908 emit finished(_fileNameString, this);
909 }
910 892
911 _isRunning = false;893 _isRunning = false;
912 if (_wantSignals) {894 emit runningStateChanged();
913 emit runningStateChanged();895 emit doneRunning();
914 emit doneRunning();
915 }
916}896}
917 897
918// NOTE: This is private because it must be called on the same thread that created the timers, which is why898// NOTE: This is private because it must be called on the same thread that created the timers, which is why
@@ -950,9 +930,7 @@ void ScriptEngine::stop() { · 31 unmodified lines
950 return;930 return;
951 }931 }
952 _isFinished = true;932 _isFinished = true;
953 if (_wantSignals) {933 emit runningStateChanged();
954 emit runningStateChanged();
955 }
956 }934 }
957}935}
958 936
@@ -1076,9 +1054,7 @@ QUrl ScriptEngine::resolvePath(const QString& include) const { · 117 unmodified lines
1076}1054}
1077 1055
1078void ScriptEngine::print(const QString& message) {1056void ScriptEngine::print(const QString& message) {
1079 if (_wantSignals) {1057 emit printedMessage(message);
1080 emit printedMessage(message);
1081 }
1082}1058}
1083 1059
1084// If a callback is specified, the included files will be loaded asynchronously and the callback will be called1060// If a callback is specified, the included files will be loaded asynchronously and the callback will be called
@@ -1214,13 +1190,9 @@ void ScriptEngine::load(const QString& loadFile) { · 129 unmodified lines
1214 if (_isReloading) {1190 if (_isReloading) {
1215 auto scriptCache = DependencyManager::get<ScriptCache>();1191 auto scriptCache = DependencyManager::get<ScriptCache>();
1216 scriptCache->deleteScript(url.toString());1192 scriptCache->deleteScript(url.toString());
1217 if (_wantSignals) {1193 emit reloadScript(url.toString(), false);
1218 emit reloadScript(url.toString(), false);
1219 }
1220 } else {1194 } else {
1221 if (_wantSignals) {1195 emit loadScript(url.toString(), false);
1222 emit loadScript(url.toString(), false);
1223 }
1224 }1196 }
1225}1197}
1226 1198