aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r--src/qml/qml/qqmlengine.cpp96
1 files changed, 33 insertions, 63 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 5db918dd73..71795a2539 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -1,31 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 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:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** 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 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** 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.
**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
@@ -176,6 +182,7 @@ void QQmlEnginePrivate::registerBaseTypes(const char *uri, int versionMajor, int
qmlRegisterType<QQmlComponent>(uri,versionMajor,versionMinor,"Component");
qmlRegisterType<QObject>(uri,versionMajor,versionMinor,"QtObject");
qmlRegisterType<QQmlBind>(uri, versionMajor, versionMinor,"Binding");
+ qmlRegisterType<QQmlConnections,1>(uri, versionMajor, (versionMinor < 3 ? 3 : versionMinor), "Connections"); //Only available in >=2.3
qmlRegisterType<QQmlConnections>(uri, versionMajor, versionMinor,"Connections");
qmlRegisterType<QQmlTimer>(uri, versionMajor, versionMinor,"Timer");
qmlRegisterType<QQmlInstantiator>(uri, versionMajor, (versionMinor < 1 ? 1 : versionMinor), "Instantiator"); //Only available in >=2.1
@@ -397,11 +404,11 @@ The following functions are also on the Qt object.
\li \c "android" - Android
\li \c "blackberry" - BlackBerry OS
\li \c "ios" - iOS
+ \li \c "tvos" - tvOS
\li \c "linux" - Linux
\li \c "osx" - \macos
\li \c "unix" - Other Unix-based OS
\li \c "windows" - Windows
- \li \c "wince" - Windows CE
\li \c "winrt" - Windows Runtime
\li \c "winphone" - Windows Phone
\endlist
@@ -867,11 +874,6 @@ void QQmlEnginePrivate::init()
v8engine()->setEngine(q);
rootContext = new QQmlContext(q,true);
-
- if (QCoreApplication::instance()->thread() == q->thread() && QQmlDebugConnector::instance()) {
- QQmlDebugConnector::instance()->open();
- QQmlDebugConnector::instance()->addEngine(q);
- }
}
QQuickWorkerScriptEngine *QQmlEnginePrivate::getWorkerScriptEngine()
@@ -923,6 +925,7 @@ QQmlEngine::QQmlEngine(QObject *parent)
{
Q_D(QQmlEngine);
d->init();
+ QJSEnginePrivate::addToDebugServer(this);
}
/*!
@@ -947,9 +950,7 @@ QQmlEngine::QQmlEngine(QQmlEnginePrivate &dd, QObject *parent)
QQmlEngine::~QQmlEngine()
{
Q_D(QQmlEngine);
- QQmlDebugConnector *server = QQmlDebugConnector::instance();
- if (server)
- server->removeEngine(this);
+ QJSEnginePrivate::removeFromDebugServer(this);
d->typeLoader.invalidate();
@@ -1598,15 +1599,6 @@ void QQmlData::addNotify(int index, QQmlNotifierEndpoint *endpoint)
}
}
-/*
- index MUST in the range returned by QObjectPrivate::signalIndex()
- This is different than the index returned by QMetaMethod::methodIndex()
-*/
-bool QQmlData::signalHasEndpoint(int index)
-{
- return notifyList && (notifyList->connectionMask & (1ULL << quint64(index % 64)));
-}
-
void QQmlData::disconnectNotifiers()
{
if (notifyList) {
@@ -1902,38 +1894,16 @@ void QQmlEnginePrivate::warning(QQmlEnginePrivate *engine, const QList<QQmlError
dumpwarning(error);
}
-/*
- This function should be called prior to evaluation of any js expression,
- so that scarce resources are not freed prematurely (eg, if there is a
- nested javascript expression).
- */
-void QQmlEnginePrivate::referenceScarceResources()
+void QQmlEnginePrivate::cleanupScarceResources()
{
- scarceResourcesRefCount += 1;
-}
-
-/*
- This function should be called after evaluation of the js expression is
- complete, and so the scarce resources may be freed safely.
- */
-void QQmlEnginePrivate::dereferenceScarceResources()
-{
- Q_ASSERT(scarceResourcesRefCount > 0);
- scarceResourcesRefCount -= 1;
-
- // if the refcount is zero, then evaluation of the "top level"
- // expression must have completed. We can safely release the
- // scarce resources.
- if (scarceResourcesRefCount == 0) {
- // iterate through the list and release them all.
- // note that the actual SRD is owned by the JS engine,
- // so we cannot delete the SRD; but we can free the
- // memory used by the variant in the SRD.
- QV4::ExecutionEngine *engine = QV8Engine::getV4(v8engine());
- while (QV4::ExecutionEngine::ScarceResourceData *sr = engine->scarceResources.first()) {
- sr->data = QVariant();
- engine->scarceResources.remove(sr);
- }
+ // iterate through the list and release them all.
+ // note that the actual SRD is owned by the JS engine,
+ // so we cannot delete the SRD; but we can free the
+ // memory used by the variant in the SRD.
+ QV4::ExecutionEngine *engine = QV8Engine::getV4(v8engine());
+ while (QV4::ExecutionEngine::ScarceResourceData *sr = engine->scarceResources.first()) {
+ sr->data = QVariant();
+ engine->scarceResources.remove(sr);
}
}