diff --git a/interface/src/raypick/LaserPointer.cpp b/interface/src/raypick/LaserPointer.cpp index e742108184..8d18479091 100644 --- a/interface/src/raypick/LaserPointer.cpp +++ b/interface/src/raypick/LaserPointer.cpp @@ -53,7 +53,6 @@ PickResultPointer LaserPointer::getPickResultCopy(const PickResultPointer& pickR } QVariantMap LaserPointer::toVariantMap() const { - //V8TODO: this cannot be done anymore without script engine QVariantMap qVariantMap = Parent::toVariantMap(); QVariantMap qRenderStates; diff --git a/interface/src/raypick/PointerScriptingInterface.cpp b/interface/src/raypick/PointerScriptingInterface.cpp index 61c75ee016..cb83a67199 100644 --- a/interface/src/raypick/PointerScriptingInterface.cpp +++ b/interface/src/raypick/PointerScriptingInterface.cpp @@ -542,7 +542,7 @@ std::shared_ptr PointerScriptingInterface::buildParabolaPointer(const P } void PointerScriptingInterface::editRenderState(unsigned int uid, const QString& renderState, const QVariant& properties) const { - //V8TODO: this won't work for now + //V8TODO: this needs testing QVariantMap propMap = properties.toMap(); QVariant startProps; diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 42cec567dc..721632c6c7 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -51,8 +51,7 @@ STATIC_SCRIPT_TYPES_INITIALIZER((+[](ScriptManager* manager){ RayToOverlayIntersectionResultFromScriptValue>(scriptEngine); })); -// V8TODO: _scriptEngine can be safely removed as soon as 3D overlays are not used anymore by default scripts -Overlays::Overlays() /*: _scriptEngine(newScriptEngine())*/ { +Overlays::Overlays() { ADD_TYPE_MAP(Box, cube); ADD_TYPE_MAP(Sphere, sphere); _overlayToEntityTypes["rectangle3d"] = "Shape"; @@ -310,12 +309,6 @@ QString Overlays::entityToOverlayType(const QString& type) { static QHash> savedRotations = QHash>(); -// V8TODO: This can be safely removed as soon as 3D overlays are not used anymore by default scripts -/*EntityItemProperties Overlays::convertOverlayToEntityProperties(QVariantMap& overlayProps, const QString& type, bool add, const QUuid& id) { - std::pair rotation; - return convertOverlayToEntityProperties(overlayProps, rotation, type, add, id); -}*/ - // V8TODO: This can be safely removed as soon as 3D overlays are not used anymore by default scripts /*EntityItemProperties Overlays::convertOverlayToEntityProperties(QVariantMap& overlayProps, std::pair& rotationToSave, const QString& type, bool add, const QUuid& id) { overlayProps["type"] = type; @@ -815,22 +808,6 @@ QUuid Overlays::addOverlay(const QString& type, const QVariant& properties) { } return UNKNOWN_ENTITY_ID; - // V8TODO: This can be safely removed as soon as 3D overlays are not used anymore by default scripts - /*QString entityType = overlayToEntityType(type); - if (entityType == "Unknown") { - return UNKNOWN_ENTITY_ID; - } - - QVariantMap propertyMap = properties.toMap(); - if (type == "rectangle3d") { - propertyMap["shape"] = "Quad"; - } - std::pair rotationToSave; - QUuid id = DependencyManager::get()->addEntityInternal(convertOverlayToEntityProperties(propertyMap, rotationToSave, entityType, true), entity::HostType::LOCAL); - if (entityType == "Text" || entityType == "Image" || entityType == "Grid" || entityType == "Web") { - savedRotations[id] = rotationToSave; - } - return id;*/ } QUuid Overlays::add2DOverlay(const Overlay::Pointer& overlay) { @@ -889,13 +866,6 @@ bool Overlays::editOverlay(const QUuid& id, const QVariant& properties) { } return false; - - // V8TODO: This can be safely removed as soon as 3D overlays are not used anymore by default scripts - /* - auto entityScriptingInterface = DependencyManager::get(); - auto propertyMap = properties.toMap(); - EntityItemProperties entityProperties = convertOverlayToEntityProperties(propertyMap, entityScriptingInterface->getEntityType(id), false, id); - return !entityScriptingInterface->editEntity(id, entityProperties).isNull();*/ } bool Overlays::editOverlays(const QVariant& propertiesById) { @@ -907,7 +877,6 @@ bool Overlays::editOverlays(const QVariant& propertiesById) { QVariantMap deferred; const QVariantMap map = propertiesById.toMap(); - //auto entityScriptingInterface = DependencyManager::get(); for (const auto& key : map.keys()) { QUuid id = QUuid(key); const QVariant& properties = map[key]; @@ -921,9 +890,6 @@ bool Overlays::editOverlays(const QVariant& propertiesById) { overlay->setProperties(properties.toMap()); } else { qDebug() << "Overlays::editOverlays doesn't support editing entities anymore"; - // V8TODO: This can be safely removed as soon as 3D overlays are not used anymore by default scripts - /*auto propertyMap = properties.toMap(); - entityScriptingInterface->editEntity(id, convertOverlayToEntityProperties(propertyMap, entityScriptingInterface->getEntityType(id), false, id));*/ } } diff --git a/interface/src/ui/overlays/Overlays.h b/interface/src/ui/overlays/Overlays.h index 95b06247f7..f96424553e 100644 --- a/interface/src/ui/overlays/Overlays.h +++ b/interface/src/ui/overlays/Overlays.h @@ -123,9 +123,6 @@ public: void cleanupAllOverlays(); - // V8TODO: This can be safely removed as soon as 3D overlays are not used anymore by default scripts - //mutable ScriptEnginePointer _scriptEngine; - public slots: /*@jsdoc * Adds an overlay to the scene. @@ -763,16 +760,9 @@ private: QMouseEvent* event, PointerEvent::EventType eventType); static QString entityToOverlayType(const QString& type); - // V8TODO: This can be safely removed as soon as 3D overlays are not used anymore by default scripts - //static QString overlayToEntityType(const QString& type); static std::unordered_map _entityToOverlayTypes; static std::unordered_map _overlayToEntityTypes; - // V8TODO: This can be safely removed as soon as 3D overlays are not used anymore by default scripts - /*QVariantMap convertEntityToOverlayProperties(const EntityItemProperties& entityProps); - EntityItemProperties convertOverlayToEntityProperties(QVariantMap& overlayProps, const QString& type, bool add, const QUuid& id); - EntityItemProperties convertOverlayToEntityProperties(QVariantMap& overlayProps, std::pair& rotationToSave, const QString& type, bool add, const QUuid& id = QUuid());*/ - private slots: void mousePressOnPointerEvent(const QUuid& id, const PointerEvent& event); void mousePressOffPointerEvent(); diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index fa417772c8..db2c92b344 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -1680,6 +1680,7 @@ bool EntityScriptingInterface::getServerScriptStatus(const QUuid& entityID, Scri auto engine = callback.engine(); // V8TODO: it seems to sometimes be called on a wrong thread, reading to script engine crashes. I added an assert for now. // V8TODO: somehow the asserts are not happening here, but destructor still runs on main thread sometimes and deadlocks. + // V8TODO: I think this was fixed? Should be tested Q_ASSERT(QThread::currentThread() == engine->thread()); Q_ASSERT(QThread::currentThread() == engine->manager()->thread()); QString statusString = EntityScriptStatus_::valueToKey(request->getStatus()); diff --git a/libraries/script-engine/src/ScriptEngine.h b/libraries/script-engine/src/ScriptEngine.h index 38722c2f39..8aa001a50a 100644 --- a/libraries/script-engine/src/ScriptEngine.h +++ b/libraries/script-engine/src/ScriptEngine.h @@ -27,7 +27,6 @@ #include "ScriptException.h" // These are used for debugging memory leaks caused by persistent handles -// V8TODO: Rename to something better, like for example OVERTE_V8_MEMORY_DEBUG #define OVERTE_V8_MEMORY_DEBUG class QByteArray; diff --git a/libraries/script-engine/src/ScriptValue.h b/libraries/script-engine/src/ScriptValue.h index 8aaded85a9..38059c4d06 100644 --- a/libraries/script-engine/src/ScriptValue.h +++ b/libraries/script-engine/src/ScriptValue.h @@ -119,8 +119,6 @@ public: inline QObject* toQObject() const; protected: - //V8TODO - //Won't a regular pointer cause memory leak? ScriptValueProxy* _proxy; }; Q_DECLARE_OPERATORS_FOR_FLAGS(ScriptValue::PropertyFlags); diff --git a/libraries/script-engine/src/ScriptValueUtils.cpp b/libraries/script-engine/src/ScriptValueUtils.cpp index 665313cb7d..f888c4767d 100644 --- a/libraries/script-engine/src/ScriptValueUtils.cpp +++ b/libraries/script-engine/src/ScriptValueUtils.cpp @@ -282,7 +282,7 @@ bool vec3FromScriptValue(const ScriptValue& object, glm::vec3& vec3) { } if (!x.isValid() || !y.isValid() || !z.isValid()) { - // V8TODO: This breaks the sit script for some reason + // V8TODO: This breaks the sit script because in our API valid Vec3 can be created from just 2 values //return false; } diff --git a/libraries/script-engine/src/Vec3.h b/libraries/script-engine/src/Vec3.h index 439130737b..e63a7cd7ca 100644 --- a/libraries/script-engine/src/Vec3.h +++ b/libraries/script-engine/src/Vec3.h @@ -421,7 +421,6 @@ private: const glm::vec3& UP() { return Vectors::UP; } const glm::vec3& FRONT() { return Vectors::FRONT; } - //V8TODO delete after V8 works - used only for debugging public: virtual ~Vec3(); }; diff --git a/libraries/script-engine/src/XMLHttpRequestClass.cpp b/libraries/script-engine/src/XMLHttpRequestClass.cpp index 7d4564adca..caca759096 100644 --- a/libraries/script-engine/src/XMLHttpRequestClass.cpp +++ b/libraries/script-engine/src/XMLHttpRequestClass.cpp @@ -221,6 +221,7 @@ void XMLHttpRequestClass::requestFinished() { _rawResponseData.append(_reply->readAll()); if (_responseType == "json") { + // V8TODO: V8 JSON parser needs to be used instead _responseData = _engine->evaluate("(" + QString(_rawResponseData.data()) + ")"); if (_responseData.isError()) { _engine->clearExceptions(); diff --git a/libraries/script-engine/src/v8/ScriptEngineV8.cpp b/libraries/script-engine/src/v8/ScriptEngineV8.cpp index 2929eecc82..669d1a92bb 100644 --- a/libraries/script-engine/src/v8/ScriptEngineV8.cpp +++ b/libraries/script-engine/src/v8/ScriptEngineV8.cpp @@ -966,7 +966,6 @@ ScriptValue ScriptEngineV8::newArrayBuffer(const QByteArray& message) { v8::Isolate::Scope isolateScope(_v8Isolate); v8::HandleScope handleScope(_v8Isolate); v8::Context::Scope contextScope(getContext()); - //V8TODO: this will leak memory std::shared_ptr backingStore(v8::ArrayBuffer::NewBackingStore(_v8Isolate, message.size())); std::memcpy(backingStore.get()->Data(), message.constData(), message.size()); auto arrayBuffer = v8::ArrayBuffer::New(_v8Isolate, backingStore); diff --git a/libraries/script-engine/src/v8/ScriptObjectV8Proxy.cpp b/libraries/script-engine/src/v8/ScriptObjectV8Proxy.cpp index b515c3bf2c..aaee5ee76c 100644 --- a/libraries/script-engine/src/v8/ScriptObjectV8Proxy.cpp +++ b/libraries/script-engine/src/v8/ScriptObjectV8Proxy.cpp @@ -213,7 +213,6 @@ ScriptObjectV8Proxy::~ScriptObjectV8Proxy() { v8::HandleScope handleScope(isolate); if (_object) qCDebug(scriptengine_v8) << "Deleting object proxy: " << name(); - // V8TODO: once WeakPersistent pointer is added we should check if it's valid before deleting Q_ASSERT(!_v8Object.Get(isolate)->IsNullOrUndefined()); // This prevents unwrap function from unwrapping proxy that was deleted _v8Object.Get(isolate)->SetAlignedPointerInInternalField(0, const_cast(internalPointsToDeletedQObjectProxy)); @@ -359,9 +358,7 @@ void ScriptObjectV8Proxy::investigate() { v8Object->SetInternalField(2, propertiesObject); // Add all the methods objects as properties - this allows adding properties to a given method later. Is used by Script.request. - // V8TODO: Should these be deleted when the script-owned object is destroyed? It needs checking if script-owned objects will be garbage-collected, or will self-referencing prevent it. for (auto i = _methods.begin(); i != _methods.end(); i++) { - //V8TODO: lifetime may prevent garbage collection? V8ScriptValue method = ScriptMethodV8Proxy::newMethod(_engine, qobject, V8ScriptValue(_engine, v8Object), i.value().methods, i.value().numMaxParams); if(!propertiesObject->Set(_engine->getContext(), v8::String::NewFromUtf8(isolate, i.value().name.toStdString().c_str()).ToLocalChecked(), method.get()).FromMaybe(false)) { diff --git a/libraries/script-engine/src/v8/ScriptValueV8Wrapper.h b/libraries/script-engine/src/v8/ScriptValueV8Wrapper.h index e9ccb3a02d..88134cd674 100644 --- a/libraries/script-engine/src/v8/ScriptValueV8Wrapper.h +++ b/libraries/script-engine/src/v8/ScriptValueV8Wrapper.h @@ -101,7 +101,6 @@ private: // helper functions private: // storage ScriptEngineV8 *_engine; - //V8TODO: this needs a persistent handle instead, maybe with set weak? V8ScriptValue _value; Q_DISABLE_COPY(ScriptValueV8Wrapper) diff --git a/libraries/shared/src/shared/WebRTC.h b/libraries/shared/src/shared/WebRTC.h index 4163e2fc21..ef194e971a 100644 --- a/libraries/shared/src/shared/WebRTC.h +++ b/libraries/shared/src/shared/WebRTC.h @@ -37,13 +37,8 @@ // # define WEBRTC_POSIX 1 // # define WEBRTC_LEGACY 1 #elif defined(Q_OS_LINUX) && defined(Q_PROCESSOR_X86_64) -//V8TODO: -// WEBRTC_AUDIO causes: -// overte/libraries/audio-client/src/AudioClient.cpp:1258:36: runtime error: member call on address 0x61b000006980 which does not point to an object of type 'AudioProcessing' -// 0x61b000006980: note: object has invalid vptr # define WEBRTC_AUDIO 1 # define WEBRTC_POSIX 1 -//V8TODO: temporarily disabled, because linker failed for memory debugging # define WEBRTC_DATA_CHANNELS 1 #elif defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM) // WebRTC is basically impossible to build on aarch64 Linux.