Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 10 files). Show all
Unified · Split
| @@ -32,13 +32,13 @@ · 31 unmodified lines | ||
| 32 | 32 | #include <VoxelDetail.h> |
| 33 | 33 | |
| 34 | 34 | #include "AnimationObject.h" |
| 35 | −#include "ArrayBufferClass.h" | |
| 36 | 35 | #include "ArrayBufferViewClass.h" |
| 37 | 36 | #include "DataViewClass.h" |
| 38 | 37 | #include "MenuItemProperties.h" |
| 39 | 38 | #include "MIDIEvent.h" |
| 40 | 39 | #include "LocalVoxels.h" |
| 41 | 40 | #include "ScriptEngine.h" |
| 41 | +#include "TypedArrays.h" | |
| 42 | 42 | #include "XMLHttpRequestClass.h" |
| 43 | 43 | |
| 44 | 44 | VoxelsScriptingInterface ScriptEngine::_voxelsScriptingInterface; |
| @@ -93,8 +93,15 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam · 48 unmodified lines | ||
| 93 | 93 | _quatLibrary(), |
| 94 | 94 | _vec3Library(), |
| 95 | 95 | _uuidLibrary(), |
| 96 | − _animationCache(this) | |
| 96 | + _animationCache(this), | |
| 97 | + _arrayBufferClass(NULL) | |
| 97 | 98 | { |
| 99 | + _arrayBufferClass = new ArrayBufferClass(this); | |
| 100 | + qDebug() << "Engine: " << this; | |
| 101 | + qDebug() << "ArrayBuffer: " <<_arrayBufferClass; | |
| 102 | + qDebug() << "DataView: " << new DataViewClass(this); | |
| 103 | + qDebug() << "Int8Array: " << new Int8ArrayClass(this); | |
| 104 | + qDebug() << "Initial thread: " << QThread::currentThread() << " " << thread(); | |
| 98 | 105 | } |
| 99 | 106 | |
| 100 | 107 | ScriptEngine::ScriptEngine(const QUrl& scriptURL, |
| @@ -118,13 +125,21 @@ ScriptEngine::ScriptEngine(const QUrl& scriptURL, · 17 unmodified lines | ||
| 118 | 125 | _quatLibrary(), |
| 119 | 126 | _vec3Library(), |
| 120 | 127 | _uuidLibrary(), |
| 121 | − _animationCache(this) | |
| 128 | + _animationCache(this), | |
| 129 | + _arrayBufferClass(NULL) | |
| 122 | 130 | { |
| 123 | 131 | QString scriptURLString = scriptURL.toString(); |
| 124 | 132 | _fileNameString = scriptURLString; |
| 125 | 133 | |
| 126 | 134 | QUrl url(scriptURL); |
| 127 | − | |
| 135 | + | |
| 136 | + _arrayBufferClass = new ArrayBufferClass(this); | |
| 137 | + qDebug() << "Engine: " << this; | |
| 138 | + qDebug() << "ArrayBuffer: " <<_arrayBufferClass; | |
| 139 | + qDebug() << "DataView: " << new DataViewClass(this); | |
| 140 | + qDebug() << "Int8Array: " << new Int8ArrayClass(this); | |
| 141 | + qDebug() << "Initial thread: " << QThread::currentThread() << " " << thread(); | |
| 142 | + | |
| 128 | 143 | // if the scheme length is one or lower, maybe they typed in a file, let's try |
| 129 | 144 | const int WINDOWS_DRIVE_LETTER_SIZE = 1; |
| 130 | 145 | if (url.scheme().size() <= WINDOWS_DRIVE_LETTER_SIZE) { |
| @@ -141,6 +156,7 @@ ScriptEngine::ScriptEngine(const QUrl& scriptURL, · 10 unmodified lines | ||
| 141 | 156 | QTextStream in(&scriptFile); |
| 142 | 157 | _scriptContents = in.readAll(); |
| 143 | 158 | } else { |
| 159 | + | |
| 144 | 160 | qDebug() << "ERROR Loading file:" << fileName; |
| 145 | 161 | emit errorMessage("ERROR Loading file:" + fileName); |
| 146 | 162 | } |
| @@ -213,10 +229,6 @@ void ScriptEngine::init() { · 66 unmodified lines | ||
| 213 | 229 | if (_isInitialized) { |
| 214 | 230 | return; // only initialize once |
| 215 | 231 | } |
| 216 | − | |
| 217 | − new ArrayBufferClass(&_engine); | |
| 218 | − new ArrayBufferViewClass(&_engine); | |
| 219 | − new DataViewClass(&_engine); | |
| 220 | 232 | |
| 221 | 233 | _isInitialized = true; |
| 222 | 234 | |