diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-05-22 16:35:28 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-05-22 17:05:04 +0200 |
commit | d1b56de13b82437b9bcb1c49bb9c93b419d51be1 (patch) | |
tree | 85971e81cc9f9ffd0bb86ff3ad0da19619dae5f8 | |
parent | 7b3225865800ec0eddff2665f2660f7927d8699c (diff) |
Remove QV8Engine::scriptValueFromInternal
Change-Id: I43d672d17c0bbb498be71d7a25f8ca1389aeadf7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r-- | src/qml/qml/qqmlproperty.cpp | 5 | ||||
-rw-r--r-- | src/qml/qml/v8/qjsengine.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/v8/qv8engine.cpp | 7 | ||||
-rw-r--r-- | src/qml/qml/v8/qv8engine_p.h | 2 | ||||
-rw-r--r-- | 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 583e243b3c..8fd65bd1f3 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 <private/qjsvalue_p.h> #include <private/qv8bindings_p.h> #include <QStringList> @@ -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 50e826522b..f85f24a0bf 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 e9de7e8177..188c8e3ebc 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<QJSValue>()) - 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<v8::Value>(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 9ce7c767ab..254445d0b0 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 1e4ef04e12..0a3bd0b349 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<QJSValue>()) { - 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)) |