From d1b56de13b82437b9bcb1c49bb9c93b419d51be1 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 22 May 2013 16:35:28 +0200 Subject: [PATCH] Remove QV8Engine::scriptValueFromInternal Change-Id: I43d672d17c0bbb498be71d7a25f8ca1389aeadf7 Reviewed-by: Simon Hausmann --- src/qml/qml/qqmlproperty.cpp | 5 ++++- src/qml/qml/v8/qjsengine.cpp | 2 +- src/qml/qml/v8/qv8engine.cpp | 7 +------ src/qml/qml/v8/qv8engine_p.h | 2 -- src/qml/qml/v8/qv8qobjectwrapper.cpp | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index 583e243..8fd65bd 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -56,6 +56,7 @@ #include "qqmlvmemetaobject_p.h" #include "qqmlexpression_p.h" #include "qqmlvaluetypeproxybinding_p.h" +#include #include #include @@ -1572,7 +1573,9 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object, expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration.")); return false; } - writeValueProperty(object, core, QVariant::fromValue(v8engine->scriptValueFromInternal(result->v4Value())), context, flags); + writeValueProperty(object, core, QVariant::fromValue( + QJSValue(new QJSValuePrivate(QV8Engine::getV4(v8engine), result->v4Value()))), + context, flags); } else if (isUndefined) { QString errorStr = QLatin1String("Unable to assign [undefined] to "); if (!QMetaType::typeName(type)) diff --git a/src/qml/qml/v8/qjsengine.cpp b/src/qml/qml/v8/qjsengine.cpp index 50e8265..f85f24a 100644 --- a/src/qml/qml/v8/qjsengine.cpp +++ b/src/qml/qml/v8/qjsengine.cpp @@ -320,7 +320,7 @@ QJSValue QJSEngine::newQObject(QObject *object) { // ### Q_D(QJSEngine); - return d->scriptValueFromInternal(d->newQObject(object, QV8Engine::JavaScriptOwnership)); + return new QJSValuePrivate(QV8Engine::getV4(d), d->newQObject(object, QV8Engine::JavaScriptOwnership)); } /*! diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index e9de7e8..188c8e3 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -199,7 +199,7 @@ QVariant QV8Engine::toVariant(const QV4::Value &value, int typeHint) return QVariant::fromValue(jsonValueFromJS(value)); if (typeHint == qMetaTypeId()) - return QVariant::fromValue(scriptValueFromInternal(value)); + return QVariant::fromValue(QJSValue(new QJSValuePrivate(m_v4Engine, value))); if (QV4::Object *object = value.asObject()) { QV8ObjectResource *r = (QV8ObjectResource *)v8::Handle(value)->ToObject()->GetExternalResource(); @@ -1306,11 +1306,6 @@ QObject *QV8Engine::qtObjectFromJS(const QV4::Value &value) return 0; } -QJSValue QV8Engine::scriptValueFromInternal(const QV4::Value &value) const -{ - return new QJSValuePrivate(m_v4Engine, value); -} - void QV8Engine::startTimer(const QString &timerName) { if (!m_time.isValid()) diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h index 9ce7c76..254445d 100644 --- a/src/qml/qml/v8/qv8engine_p.h +++ b/src/qml/qml/v8/qv8engine_p.h @@ -365,8 +365,6 @@ public: const QByteArray &targetType, void **result); - QJSValue scriptValueFromInternal(const QV4::Value &) const; - // used for console.time(), console.timeEnd() void startTimer(const QString &timerName); qint64 stopTimer(const QString &timerName, bool *wasRunning); diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp index 1e4ef04..0a3bd0b 100644 --- a/src/qml/qml/v8/qv8qobjectwrapper.cpp +++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp @@ -659,7 +659,7 @@ static inline void StoreProperty(QV8Engine *engine, QObject *object, QQmlPropert } else if (value->IsUndefined() && property->propType == QMetaType::QJsonValue) { PROPERTY_STORE(QJsonValue, QJsonValue(QJsonValue::Undefined)); } else if (!newBinding && property->propType == qMetaTypeId()) { - PROPERTY_STORE(QJSValue, engine->scriptValueFromInternal(value->v4Value())); + PROPERTY_STORE(QJSValue, new QJSValuePrivate(QV8Engine::getV4(engine), value->v4Value())); } else if (value->IsUndefined()) { QString error = QLatin1String("Cannot assign [undefined] to "); if (!QMetaType::typeName(property->propType)) -- 2.7.4