Remove v8engine pointer from QQmlV4Function
authorLars Knoll <lars.knoll@theqtcompany.com>
Tue, 30 Dec 2014 16:06:02 +0000 (17:06 +0100)
committerLars Knoll <lars.knoll@digia.com>
Thu, 8 Jan 2015 11:34:25 +0000 (12:34 +0100)
Change-Id: I68ddd79b8866ef9b8628a2eab1118d3ee3d72759
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/imports/localstorage/plugin.cpp
src/qml/jsruntime/qv4qobjectwrapper.cpp
src/qml/qml/qqmlcomponent.cpp
src/qml/qml/v8/qv8engine_p.h
tests/auto/qml/qqmlecmascript/testtypes.cpp

index 6df795f..8dfdde9 100644 (file)
@@ -668,13 +668,13 @@ public:
 void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args)
 {
 #ifndef QT_NO_SETTINGS
-    QV8Engine *engine = args->engine();
     QV4::Scope scope(args->v4engine());
+    QV8Engine *engine = scope.engine->v8Engine;
     QV4::ScopedContext ctx(scope, args->v4engine()->currentContext());
-    if (engine->engine()->offlineStoragePath().isEmpty())
+    if (scope.engine->qmlEngine()->offlineStoragePath().isEmpty())
         V4THROW_SQL2(SQLEXCEPTION_DATABASE_ERR, QQmlEngine::tr("SQL: can't create database, offline storage is disabled."));
 
-    qmlsqldatabase_initDatabasesPath(engine);
+    qmlsqldatabase_initDatabasesPath(scope.engine->v8Engine);
 
     QSqlDatabase database;
 
@@ -689,7 +689,7 @@ void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args)
     md5.addData(dbname.toUtf8());
     QString dbid(QLatin1String(md5.result().toHex()));
 
-    QString basename = qmlsqldatabase_databaseFile(dbid, engine);
+    QString basename = qmlsqldatabase_databaseFile(dbid, scope.engine->v8Engine);
     bool created = false;
     QString version = dbversion;
 
index 4a4d3f1..d2b98a0 100644 (file)
@@ -1871,7 +1871,7 @@ ReturnedValue QObjectMethod::callInternal(CallData *callData)
         QV4::ScopedValue qmlGlobal(scope, d()->qmlGlobal);
         QQmlV4Function func(callData, rv, qmlGlobal,
                             QmlContextWrapper::getContext(qmlGlobal),
-                            scope.engine->v8Engine);
+                            scope.engine);
         QQmlV4Function *funcptr = &func;
 
         void *args[] = { 0, &funcptr };
index 894d02f..115046f 100644 (file)
@@ -1361,9 +1361,9 @@ void QQmlComponent::incubateObject(QQmlV4Function *args)
             mode = QQmlIncubator::AsynchronousIfNested;
     }
 
-    QQmlComponentExtension *e = componentExtension(args->engine());
+    QQmlComponentExtension *e = componentExtension(args->v4engine()->v8Engine);
 
-    QV4::Scoped<QV4::QmlIncubatorObject> r(scope, v4->memoryManager->alloc<QV4::QmlIncubatorObject>(args->engine(), mode));
+    QV4::Scoped<QV4::QmlIncubatorObject> r(scope, v4->memoryManager->alloc<QV4::QmlIncubatorObject>(args->v4engine()->v8Engine, mode));
     QV4::ScopedObject p(scope, e->incubationProto.value());
     r->setPrototype(p);
 
index 131be2e..41564cc 100644 (file)
@@ -122,8 +122,7 @@ public:
     QQmlContextData *context() { return ctx; }
     QV4::ReturnedValue qmlGlobal() { return callData->thisObject.asReturnedValue(); }
     void setReturnValue(QV4::ReturnedValue rv) { retVal = rv; }
-    QV8Engine *engine() const { return e; }
-    QV4::ExecutionEngine *v4engine() const;
+    QV4::ExecutionEngine *v4engine() const { return e; }
 private:
     friend struct QV4::QObjectMethod;
     QQmlV4Function();
@@ -131,7 +130,7 @@ private:
     QQmlV4Function &operator=(const QQmlV4Function &);
 
     QQmlV4Function(QV4::CallData *callData, QV4::ValueRef retVal,
-                   const QV4::ValueRef global, QQmlContextData *c, QV8Engine *e)
+                   const QV4::ValueRef global, QQmlContextData *c, QV4::ExecutionEngine *e)
         : callData(callData), retVal(retVal), ctx(c), e(e)
     {
         callData->thisObject.val = global.asReturnedValue();
@@ -140,7 +139,7 @@ private:
     QV4::CallData *callData;
     QV4::ValueRef retVal;
     QQmlContextData *ctx;
-    QV8Engine *e;
+    QV4::ExecutionEngine *e;
 };
 
 class Q_QML_PRIVATE_EXPORT QQmlV4Handle
@@ -275,10 +274,6 @@ inline QV8Engine::Deletable *QV8Engine::extensionData(int index) const
         return 0;
 }
 
-inline QV4::ExecutionEngine *QQmlV4Function::v4engine() const
-{
-    return QV8Engine::getV4(e);
-}
 
 QT_END_NAMESPACE
 
index 545e638..144537b 100644 (file)
@@ -136,7 +136,7 @@ public:
 
 void MyQmlObject::v8function(QQmlV4Function *function)
 {
-    QV8Engine::getV4(function->engine())->throwError(QStringLiteral("Exception thrown from within QObject slot"));
+    function->v4engine()->throwError(QStringLiteral("Exception thrown from within QObject slot"));
 }
 
 static QJSValue script_api(QQmlEngine *engine, QJSEngine *scriptEngine)