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
138138 return false;
139139 }
140140
141−ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNameString, bool wantSignals) :
141+ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNameString) :
142142 _scriptContents(scriptContents),
143143 _timerFunctionMap(),
144− _wantSignals(wantSignals),
145144 _fileNameString(fileNameString),
146145 _arrayBufferClass(new ArrayBufferClass(this))
147146 {
@@ -231,15 +230,14 @@ void ScriptEngine::runDebuggable() { · 83 unmodified lines
231230 return;
232231 }
233232 stopAllTimers(); // make sure all our timers are stopped if the script is ending
234− if (_wantSignals) {
235− emit scriptEnding();
236− emit finished(_fileNameString, this);
237− }
233+
234+ emit scriptEnding();
235+ emit finished(_fileNameString, this);
238236 _isRunning = false;
239− if (_wantSignals) {
240− emit runningStateChanged();
241− emit doneRunning();
242− }
237+
238+ emit runningStateChanged();
239+ emit doneRunning();
240+
243241 timer->deleteLater();
244242 return;
245243 }
@@ -249,9 +247,7 @@ void ScriptEngine::runDebuggable() { · 3 unmodified lines
249247 if (_lastUpdate < now) {
250248 float deltaTime = (float)(now - _lastUpdate) / (float)USECS_PER_SECOND;
251249 if (!_isFinished) {
252− if (_wantSignals) {
253− emit update(deltaTime);
254− }
250+ emit update(deltaTime);
255251 }
256252 }
257253 _lastUpdate = now;
@@ -358,17 +354,13 @@ void ScriptEngine::scriptContentsAvailable(const QUrl& url, const QString& scrip · 100 unmodified lines
358354 if (QRegularExpression(DEBUG_FLAG).match(scriptContents).hasMatch()) {
359355 _debuggable = true;
360356 }
361− if (_wantSignals) {
362− emit scriptLoaded(url.toString());
363− }
357+ emit scriptLoaded(url.toString());
364358 }
365359
366360 // FIXME - switch this to the new model of ScriptCache callbacks
367361 void ScriptEngine::errorInLoadingScript(const QUrl& url) {
368362 qCDebug(scriptengine) << "ERROR Loading file:" << url.toString() << "line:" << __LINE__;
369− if (_wantSignals) {
370− emit errorLoadingScript(_fileNameString); // ??
371− }
363+ emit errorLoadingScript(_fileNameString); // ??
372364 }
373365
374366 // 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
785777 --_evaluatesPending;
786778
787779 const auto hadUncaughtException = hadUncaughtExceptions(*this, program.fileName());
788− if (_wantSignals) {
789− emit evaluationFinished(result, hadUncaughtException);
790− }
780+ emit evaluationFinished(result, hadUncaughtException);
791781 return result;
792782 }
793783
@@ -801,9 +791,7 @@ void ScriptEngine::run() { · 7 unmodified lines
801791 }
802792
803793 _isRunning = true;
804− if (_wantSignals) {
805− emit runningStateChanged();
806− }
794+ emit runningStateChanged();
807795
808796 QScriptValue result = evaluate(_scriptContents, _fileNameString);
809797
@@ -872,9 +860,7 @@ void ScriptEngine::run() { · 62 unmodified lines
872860 if (_lastUpdate < now) {
873861 float deltaTime = (float) (now - _lastUpdate) / (float) USECS_PER_SECOND;
874862 if (!_isFinished) {
875− if (_wantSignals) {
876− emit update(deltaTime);
877− }
863+ emit update(deltaTime);
878864 }
879865 }
880866 _lastUpdate = now;
@@ -884,9 +870,7 @@ void ScriptEngine::run() { · 3 unmodified lines
884870 }
885871
886872 stopAllTimers(); // make sure all our timers are stopped if the script is ending
887− if (_wantSignals) {
888− emit scriptEnding();
889− }
873+ emit scriptEnding();
890874
891875 if (entityScriptingInterface->getEntityPacketSender()->serversExist()) {
892876 // release the queue of edit entity messages.
@@ -904,15 +888,11 @@ void ScriptEngine::run() { · 11 unmodified lines
904888 }
905889 }
906890
907− if (_wantSignals) {
908− emit finished(_fileNameString, this);
909− }
891+ emit finished(_fileNameString, this);
910892
911893 _isRunning = false;
912− if (_wantSignals) {
913− emit runningStateChanged();
914− emit doneRunning();
915− }
894+ emit runningStateChanged();
895+ emit doneRunning();
916896 }
917897
918898 // 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
950930 return;
951931 }
952932 _isFinished = true;
953− if (_wantSignals) {
954− emit runningStateChanged();
955− }
933+ emit runningStateChanged();
956934 }
957935 }
958936
@@ -1076,9 +1054,7 @@ QUrl ScriptEngine::resolvePath(const QString& include) const { · 117 unmodified lines
10761054 }
10771055
10781056 void ScriptEngine::print(const QString& message) {
1079− if (_wantSignals) {
1080− emit printedMessage(message);
1081− }
1057+ emit printedMessage(message);
10821058 }
10831059
10841060 // 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
12141190 if (_isReloading) {
12151191 auto scriptCache = DependencyManager::get<ScriptCache>();
12161192 scriptCache->deleteScript(url.toString());
1217− if (_wantSignals) {
1218− emit reloadScript(url.toString(), false);
1219− }
1193+ emit reloadScript(url.toString(), false);
12201194 } else {
1221− if (_wantSignals) {
1222− emit loadScript(url.toString(), false);
1223− }
1195+ emit loadScript(url.toString(), false);
12241196 }
12251197 }
12261198