aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-04-04 15:41:18 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-05-06 07:15:20 +0000
commit5032ff5c2b48d53e4580bb7d50b1f6de081263b0 (patch)
tree05acb8460793e1aed072e971d9b83deb4ea1c8aa /src
parentfee256e6414d634dcc17ed8cfbec34780878a194 (diff)
Move workerscript to its own module
Change-Id: I778cfe842ddf1c600a837d8f2061a338887eed95 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/imports.pro2
-rw-r--r--src/imports/qtquick2/plugin.cpp6
-rw-r--r--src/imports/qtquick2/qtquick2.pro2
-rw-r--r--src/imports/workerscript/dependencies.json2
-rw-r--r--src/imports/workerscript/plugin.cpp81
-rw-r--r--src/imports/workerscript/qmldir3
-rw-r--r--src/imports/workerscript/workerscript.pro11
-rw-r--r--src/qml/jsruntime/jsruntime.pri2
-rw-r--r--src/qml/jsruntime/qv4objectproto_p.h2
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp7
-rw-r--r--src/qml/jsruntime/qv4regexpobject_p.h9
-rw-r--r--src/qml/jsruntime/qv4sequenceobject_p.h2
-rw-r--r--src/qml/qml/qqmlengine.cpp16
-rw-r--r--src/qml/qml/qqmlengine_p.h4
-rw-r--r--src/qml/types/types.pri7
-rw-r--r--src/qmlworkerscript/qmlworkerscript.pro20
-rw-r--r--src/qmlworkerscript/qqmlworkerscriptmodule.cpp62
-rw-r--r--src/qmlworkerscript/qqmlworkerscriptmodule_p.h69
-rw-r--r--src/qmlworkerscript/qquickworkerscript.cpp (renamed from src/qml/types/qquickworkerscript.cpp)8
-rw-r--r--src/qmlworkerscript/qquickworkerscript_p.h (renamed from src/qml/types/qquickworkerscript_p.h)0
-rw-r--r--src/qmlworkerscript/qtqmlworkerscriptglobal.h58
-rw-r--r--src/qmlworkerscript/qtqmlworkerscriptglobal_p.h60
-rw-r--r--src/qmlworkerscript/qv4serialize.cpp (renamed from src/qml/jsruntime/qv4serialize.cpp)0
-rw-r--r--src/qmlworkerscript/qv4serialize_p.h (renamed from src/qml/jsruntime/qv4serialize_p.h)0
-rw-r--r--src/src.pro2
25 files changed, 394 insertions, 41 deletions
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index 901c263be5..6b31dfc65d 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -1,4 +1,5 @@
TEMPLATE = subdirs
+QT_FOR_CONFIG += qml-private
SUBDIRS += \
builtins \
@@ -6,6 +7,7 @@ SUBDIRS += \
models \
labsmodels
+qtConfig(qml-worker-script): SUBDIRS += workerscript
qtConfig(thread): SUBDIRS += folderlistmodel
qtHaveModule(sql): SUBDIRS += localstorage
qtConfig(settings): SUBDIRS += settings
diff --git a/src/imports/qtquick2/plugin.cpp b/src/imports/qtquick2/plugin.cpp
index a5a2c73ced..efa05c349c 100644
--- a/src/imports/qtquick2/plugin.cpp
+++ b/src/imports/qtquick2/plugin.cpp
@@ -42,6 +42,9 @@
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtQml/private/qqmlengine_p.h>
#include <QtQmlModels/private/qqmlmodelsmodule_p.h>
+#if QT_CONFIG(qml_worker_script)
+#include <QtQmlWorkerScript/private/qqmlworkerscriptmodule_p.h>
+#endif
#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <private/qtquick2_p.h>
@@ -63,6 +66,9 @@ public:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QQmlEnginePrivate::registerQuickTypes();
QQmlModelsModule::registerQuickTypes();
+#if QT_CONFIG(qml_worker_script)
+ QQmlWorkerScriptModule::registerQuickTypes();
+#endif
#endif
QQmlQtQuick2Module::defineModule();
diff --git a/src/imports/qtquick2/qtquick2.pro b/src/imports/qtquick2/qtquick2.pro
index 1b45d69eb7..8543049ead 100644
--- a/src/imports/qtquick2/qtquick2.pro
+++ b/src/imports/qtquick2/qtquick2.pro
@@ -8,4 +8,6 @@ SOURCES += \
QT += quick-private qml-private qmlmodels-private
+qtConfig(qml-worker-script): QT += qmlworkerscript-private
+
load(qml_plugin)
diff --git a/src/imports/workerscript/dependencies.json b/src/imports/workerscript/dependencies.json
new file mode 100644
index 0000000000..0d4f101c7a
--- /dev/null
+++ b/src/imports/workerscript/dependencies.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/src/imports/workerscript/plugin.cpp b/src/imports/workerscript/plugin.cpp
new file mode 100644
index 0000000000..5b3bff7934
--- /dev/null
+++ b/src/imports/workerscript/plugin.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQmlWorkerScript/private/qqmlworkerscriptmodule_p.h>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmlmodule QtQml.WorkerScript 2.\QtMinorVersion
+ \title Qt QML WorkerScript QML Types
+ \ingroup qmlmodules
+ \brief Provides QML types for worker scripts
+ \since 5.14
+
+ This QML module contains types for using worker scripts.
+
+ To use the types in this module, import the module with the following line:
+
+ \qml \QtMinorVersion
+ import QtQml.WorkerScript 2.\1
+ \endqml
+*/
+
+class QtQmlWorkerScriptPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+public:
+ QtQmlWorkerScriptPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
+ void registerTypes(const char *uri) override
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQml.WorkerScript"));
+
+ QQmlWorkerScriptModule::defineModule();
+
+ // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward
+ qmlRegisterModule(uri, 2, QT_VERSION_MINOR);
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "plugin.moc"
diff --git a/src/imports/workerscript/qmldir b/src/imports/workerscript/qmldir
new file mode 100644
index 0000000000..0e811d1dbc
--- /dev/null
+++ b/src/imports/workerscript/qmldir
@@ -0,0 +1,3 @@
+module QtQml.WorkerScript
+plugin workerscriptsplugin
+classname QtQmlWorkerScriptPlugin
diff --git a/src/imports/workerscript/workerscript.pro b/src/imports/workerscript/workerscript.pro
new file mode 100644
index 0000000000..d48e285bda
--- /dev/null
+++ b/src/imports/workerscript/workerscript.pro
@@ -0,0 +1,11 @@
+CXX_MODULE = qml
+TARGET = workerscriptplugin
+TARGETPATH = QtQml/WorkerScript.2
+IMPORT_VERSION = 2.$$QT_MINOR_VERSION
+
+SOURCES += \
+ plugin.cpp
+
+QT = qml-private qmlworkerscript-private
+
+load(qml_plugin)
diff --git a/src/qml/jsruntime/jsruntime.pri b/src/qml/jsruntime/jsruntime.pri
index a24ee0a188..ae9a36ca22 100644
--- a/src/qml/jsruntime/jsruntime.pri
+++ b/src/qml/jsruntime/jsruntime.pri
@@ -42,7 +42,6 @@ SOURCES += \
$$PWD/qv4objectiterator.cpp \
$$PWD/qv4regexp.cpp \
$$PWD/qv4runtimecodegen.cpp \
- $$PWD/qv4serialize.cpp \
$$PWD/qv4script.cpp \
$$PWD/qv4symbol.cpp \
$$PWD/qv4setobject.cpp \
@@ -109,7 +108,6 @@ HEADERS += \
$$PWD/qv4property_p.h \
$$PWD/qv4objectiterator_p.h \
$$PWD/qv4regexp_p.h \
- $$PWD/qv4serialize_p.h \
$$PWD/qv4script_p.h \
$$PWD/qv4symbol_p.h \
$$PWD/qv4setobject_p.h \
diff --git a/src/qml/jsruntime/qv4objectproto_p.h b/src/qml/jsruntime/qv4objectproto_p.h
index e9515b5b68..8707305dc2 100644
--- a/src/qml/jsruntime/qv4objectproto_p.h
+++ b/src/qml/jsruntime/qv4objectproto_p.h
@@ -74,7 +74,7 @@ struct ObjectCtor: FunctionObject
static ReturnedValue virtualCall(const FunctionObject *m, const Value *thisObject, const Value *argv, int argc);
};
-struct ObjectPrototype: Object
+struct Q_QML_PRIVATE_EXPORT ObjectPrototype: Object
{
void init(ExecutionEngine *engine, Object *ctor);
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 5bd25dcbec..64aba1d85c 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -198,13 +198,6 @@ QString RegExpObject::toString() const
return p;
}
-QString RegExpObject::source() const
-{
- Scope scope(engine());
- ScopedValue s(scope, get(scope.engine->id_source()));
- return s->toQString();
-}
-
ReturnedValue RegExpObject::builtinExec(ExecutionEngine *engine, const String *str)
{
QString s = str->toQString();
diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h
index 04b533e49d..b94889e9f0 100644
--- a/src/qml/jsruntime/qv4regexpobject_p.h
+++ b/src/qml/jsruntime/qv4regexpobject_p.h
@@ -101,7 +101,7 @@ DECLARE_HEAP_OBJECT(RegExpCtor, FunctionObject) {
}
-struct RegExpObject: Object {
+struct Q_QML_PRIVATE_EXPORT RegExpObject: Object {
V4_OBJECT2(RegExpObject, Object)
Q_MANAGED_TYPE(RegExpObject)
V4_INTERNALCLASS(RegExpObject)
@@ -145,7 +145,12 @@ struct RegExpObject: Object {
QRegularExpression toQRegularExpression() const;
#endif
QString toString() const;
- QString source() const;
+ QString source() const
+ {
+ Scope scope(engine());
+ ScopedValue s(scope, get(scope.engine->id_source()));
+ return s->toQString();
+ }
Heap::RegExp *value() const { return d()->value; }
uint flags() const { return d()->value->flags; }
diff --git a/src/qml/jsruntime/qv4sequenceobject_p.h b/src/qml/jsruntime/qv4sequenceobject_p.h
index da71215bed..886dfaa521 100644
--- a/src/qml/jsruntime/qv4sequenceobject_p.h
+++ b/src/qml/jsruntime/qv4sequenceobject_p.h
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
-struct SequencePrototype : public QV4::Object
+struct Q_QML_PRIVATE_EXPORT SequencePrototype : public QV4::Object
{
V4_PROTOTYPE(arrayPrototype)
void init();
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index bb2b3e462c..cb94ae379e 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -87,9 +87,6 @@
#include <private/qqmltimer_p.h>
#endif
#include <private/qqmlplatform_p.h>
-#if QT_CONFIG(qml_worker_script)
-#include <private/qquickworkerscript_p.h>
-#endif
#include <private/qqmlloggingcategory_p.h>
#ifdef Q_OS_WIN // for %APPDATA%
@@ -239,9 +236,6 @@ void QQmlEnginePrivate::registerQuickTypes()
#endif
qmlRegisterType<QQmlLoggingCategory>(uri, 2, 8, "LoggingCategory");
qmlRegisterType<QQmlLoggingCategory, 1>(uri, 2, 12, "LoggingCategory");
-#if QT_CONFIG(qml_worker_script)
- qmlRegisterType<QQuickWorkerScript>(uri, 2, 0, "WorkerScript");
-#endif
#if QT_CONFIG(qml_locale)
qmlRegisterUncreatableType<QQmlLocale>(uri, 2, 0, "Locale", QQmlEngine::tr("Locale cannot be instantiated. Use Qt.locale()"));
#endif
@@ -968,16 +962,6 @@ void QQmlEnginePrivate::init()
rootContext = new QQmlContext(q,true);
}
-#if QT_CONFIG(qml_worker_script)
-QQuickWorkerScriptEngine *QQmlEnginePrivate::getWorkerScriptEngine()
-{
- Q_Q(QQmlEngine);
- if (!workerScriptEngine)
- workerScriptEngine = new QQuickWorkerScriptEngine(q);
- return workerScriptEngine;
-}
-#endif
-
/*!
\class QQmlEngine
\since 5.0
diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h
index 4f7fb79593..6ef88404fd 100644
--- a/src/qml/qml/qqmlengine_p.h
+++ b/src/qml/qml/qqmlengine_p.h
@@ -94,7 +94,6 @@ class QQmlTypeNameCache;
class QQmlComponentAttached;
class QQmlCleanup;
class QQmlDelayedError;
-class QQuickWorkerScriptEngine;
class QQmlObjectCreator;
class QDir;
class QQmlIncubator;
@@ -154,8 +153,7 @@ public:
QV4::ExecutionEngine *v4engine() const { return q_func()->handle(); }
#if QT_CONFIG(qml_worker_script)
- QQuickWorkerScriptEngine *getWorkerScriptEngine();
- QQuickWorkerScriptEngine *workerScriptEngine;
+ QThread *workerScriptEngine;
#endif
QUrl baseUrl;
diff --git a/src/qml/types/types.pri b/src/qml/types/types.pri
index ba11271d66..c50273071b 100644
--- a/src/qml/types/types.pri
+++ b/src/qml/types/types.pri
@@ -8,13 +8,6 @@ HEADERS += \
$$PWD/qqmlconnections_p.h \
$$PWD/qqmlmodelindexvaluetype_p.h
-qtConfig(qml-worker-script) {
- SOURCES += \
- $$PWD/qquickworkerscript.cpp
- HEADERS += \
- $$PWD/qquickworkerscript_p.h
-}
-
qtConfig(qml-animation) {
SOURCES += \
$$PWD/qqmltimer.cpp
diff --git a/src/qmlworkerscript/qmlworkerscript.pro b/src/qmlworkerscript/qmlworkerscript.pro
new file mode 100644
index 0000000000..908caa4ed4
--- /dev/null
+++ b/src/qmlworkerscript/qmlworkerscript.pro
@@ -0,0 +1,20 @@
+TARGET = QtQmlWorkerScript
+QT = core-private qml-private
+
+DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_INTEGER_EVENT_COORDINATES QT_NO_FOREACH
+
+HEADERS += \
+ qqmlworkerscriptmodule_p.h \
+ qquickworkerscript_p.h \
+ qtqmlworkerscriptglobal.h \
+ qtqmlworkerscriptglobal_p.h \
+ qv4serialize_p.h
+
+SOURCES += \
+ qqmlworkerscriptmodule.cpp \
+ qquickworkerscript.cpp \
+ qv4serialize.cpp
+
+include(../3rdparty/masm/masm-defs.pri)
+
+load(qt_module)
diff --git a/src/qmlworkerscript/qqmlworkerscriptmodule.cpp b/src/qmlworkerscript/qqmlworkerscriptmodule.cpp
new file mode 100644
index 0000000000..98e82dbeba
--- /dev/null
+++ b/src/qmlworkerscript/qqmlworkerscriptmodule.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmlworkerscriptmodule_p.h"
+#include "qquickworkerscript_p.h"
+
+QT_BEGIN_NAMESPACE
+
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+
+void QQmlWorkerScriptModule::registerQuickTypes()
+{
+ // Don't add anything here. These are only for backwards compatibility.
+ const char uri[] = "QtQuick";
+ qmlRegisterType<QQuickWorkerScript>(uri, 2, 0, "WorkerScript");
+}
+
+#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+
+void QQmlWorkerScriptModule::defineModule()
+{
+ const char uri[] = "QtQml.WorkerScript";
+ qmlRegisterType<QQuickWorkerScript>(uri, 2, 0, "WorkerScript");
+}
+
+QT_END_NAMESPACE
diff --git a/src/qmlworkerscript/qqmlworkerscriptmodule_p.h b/src/qmlworkerscript/qqmlworkerscriptmodule_p.h
new file mode 100644
index 0000000000..a2efb304c1
--- /dev/null
+++ b/src/qmlworkerscript/qqmlworkerscriptmodule_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLWORKERSCRIPTMODULE_P_H
+#define QQMLWORKERSCRIPTMODULE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qtqmlworkerscriptglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QMLWORKERSCRIPT_PRIVATE_EXPORT QQmlWorkerScriptModule
+{
+public:
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ static void registerQuickTypes();
+#endif
+ static void defineModule();
+};
+
+QT_END_NAMESPACE
+
+#endif // QQMLWORKERSCRIPTMODULE_P_H
diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qmlworkerscript/qquickworkerscript.cpp
index c081c9e7fc..273ec2a7a6 100644
--- a/src/qml/types/qquickworkerscript.cpp
+++ b/src/qmlworkerscript/qquickworkerscript.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "qtqmlglobal_p.h"
+#include "qtqmlworkerscriptglobal_p.h"
#include "qquickworkerscript_p.h"
#include <private/qqmlengine_p.h>
#include <private/qqmlexpression_p.h>
@@ -618,7 +618,11 @@ QQuickWorkerScriptEngine *QQuickWorkerScript::engine()
return nullptr;
}
- m_engine = QQmlEnginePrivate::get(engine)->getWorkerScriptEngine();
+ QQmlEnginePrivate *enginePrivate = QQmlEnginePrivate::get(engine);
+ if (enginePrivate->workerScriptEngine == nullptr)
+ enginePrivate->workerScriptEngine = new QQuickWorkerScriptEngine(engine);
+ m_engine = qobject_cast<QQuickWorkerScriptEngine *>(enginePrivate->workerScriptEngine);
+ Q_ASSERT(m_engine);
m_scriptId = m_engine->registerWorkerScript(this);
if (m_source.isValid())
diff --git a/src/qml/types/qquickworkerscript_p.h b/src/qmlworkerscript/qquickworkerscript_p.h
index 87cf2e9754..87cf2e9754 100644
--- a/src/qml/types/qquickworkerscript_p.h
+++ b/src/qmlworkerscript/qquickworkerscript_p.h
diff --git a/src/qmlworkerscript/qtqmlworkerscriptglobal.h b/src/qmlworkerscript/qtqmlworkerscriptglobal.h
new file mode 100644
index 0000000000..be3ea4e12a
--- /dev/null
+++ b/src/qmlworkerscript/qtqmlworkerscriptglobal.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTQMLWORKERSCRIPTGLOBAL_H
+#define QTQMLWORKERSCRIPTGLOBAL_H
+
+#include <QtQml/qtqmlglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+#if !defined(QT_STATIC)
+# if defined(QT_BUILD_QMLWORKERSCRIPT_LIB)
+# define Q_QMLWORKERSCRIPT_EXPORT Q_DECL_EXPORT
+# else
+# define Q_QMLWORKERSCRIPT_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_QMLWORKERSCRIPT_EXPORT
+#endif
+
+QT_END_NAMESPACE
+#endif // QTQMLWORKERSCRIPTGLOBAL_H
diff --git a/src/qmlworkerscript/qtqmlworkerscriptglobal_p.h b/src/qmlworkerscript/qtqmlworkerscriptglobal_p.h
new file mode 100644
index 0000000000..34236cd79e
--- /dev/null
+++ b/src/qmlworkerscript/qtqmlworkerscriptglobal_p.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTQMLWORKERSCRIPTGLOBAL_P_H
+#define QTQMLWORKERSCRIPTGLOBAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQml/private/qtqmlglobal_p.h>
+#include <QtQmlWorkerScript/qtqmlworkerscriptglobal.h>
+
+#define Q_QMLWORKERSCRIPT_PRIVATE_EXPORT Q_QMLWORKERSCRIPT_EXPORT
+#define Q_QMLWORKERSCRIPT_AUTOTEST_EXPORT Q_AUTOTEST_EXPORT
+
+#endif // QTQMLWORKERSCRIPTGLOBAL_P_H
diff --git a/src/qml/jsruntime/qv4serialize.cpp b/src/qmlworkerscript/qv4serialize.cpp
index a5e62d3e35..a5e62d3e35 100644
--- a/src/qml/jsruntime/qv4serialize.cpp
+++ b/src/qmlworkerscript/qv4serialize.cpp
diff --git a/src/qml/jsruntime/qv4serialize_p.h b/src/qmlworkerscript/qv4serialize_p.h
index c8700c3ca5..c8700c3ca5 100644
--- a/src/qml/jsruntime/qv4serialize_p.h
+++ b/src/qmlworkerscript/qv4serialize_p.h
diff --git a/src/src.pro b/src/src.pro
index bd634247e7..b1e0a72c9f 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -7,6 +7,8 @@ SUBDIRS += \
qml \
qmlmodels
+qtConfig(qml-worker-script): \
+ SUBDIRS += qmlworkerscript
qtHaveModule(gui):qtConfig(qml-animation) {
SUBDIRS += \