aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypeloader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r--src/qml/qml/qqmltypeloader.cpp71
1 files changed, 32 insertions, 39 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 6480420212..f2f5cffbf8 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.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$
**
@@ -648,7 +654,7 @@ void QQmlDataBlob::notifyComplete(QQmlDataBlob *blob)
Q_ASSERT(m_waitingFor.contains(blob));
Q_ASSERT(blob->status() == Error || blob->status() == Complete);
QQmlCompilingProfiler prof(QQmlEnginePrivate::get(typeLoader()->engine())->profiler,
- blob->url());
+ blob);
m_inCallback = true;
@@ -1057,20 +1063,6 @@ void QQmlTypeLoader::loadThread(QQmlDataBlob *blob)
}
QML_MEMORY_SCOPE_URL(blob->m_url);
- QQmlEnginePrivate *engine_d = QQmlEnginePrivate::get(m_engine);
- QHash<QUrl, QByteArray> debugCache = engine_d->debugChangesCache();
-
- if (!debugCache.isEmpty()) {
- foreach (const QUrl &url, debugCache.keys()) {
- if (blob->m_url == blob->m_url.resolved(url)) {
- blob->m_data.setProgress(0xFF);
- if (blob->m_data.isAsync())
- m_thread->callDownloadProgressChanged(blob, 1.);
- setData(blob, debugCache.value(url, QByteArray()));
- return;
- }
- }
- }
if (QQmlFile::isSynchronous(blob->m_url)) {
QQmlFile file(m_engine, blob->m_url);
@@ -1216,7 +1208,7 @@ void QQmlTypeLoader::setData(QQmlDataBlob *blob, QQmlFile *file)
void QQmlTypeLoader::setData(QQmlDataBlob *blob, const QQmlDataBlob::Data &d)
{
QML_MEMORY_SCOPE_URL(blob->url());
- QQmlCompilingProfiler prof(QQmlEnginePrivate::get(engine())->profiler, blob->url());
+ QQmlCompilingProfiler prof(QQmlEnginePrivate::get(engine())->profiler, blob);
blob->m_inCallback = true;
@@ -1236,7 +1228,7 @@ void QQmlTypeLoader::setData(QQmlDataBlob *blob, const QQmlDataBlob::Data &d)
void QQmlTypeLoader::setCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit)
{
QML_MEMORY_SCOPE_URL(blob->url());
- QQmlCompilingProfiler prof(QQmlEnginePrivate::get(engine())->profiler, blob->url());
+ QQmlCompilingProfiler prof(QQmlEnginePrivate::get(engine())->profiler, blob);
blob->m_inCallback = true;
@@ -1389,13 +1381,10 @@ bool QQmlTypeLoader::Blob::addImport(const QV4::CompiledData::Import *import, QL
// Probe for all possible locations
int priority = 0;
- for (int version = QQmlImports::FullyVersioned; version <= QQmlImports::Unversioned; ++version) {
- foreach (const QString &path, remotePathList) {
- QString qmldirUrl = QQmlImports::completeQmldirPath(importUri, path, import->majorVersion, import->minorVersion,
- static_cast<QQmlImports::ImportVersion>(version));
- if (!fetchQmldir(QUrl(qmldirUrl), import, ++priority, errors))
- return false;
- }
+ const QStringList qmlDirPaths = QQmlImports::completeQmldirPaths(importUri, remotePathList, import->majorVersion, import->minorVersion);
+ for (const QString &qmldirPath : qmlDirPaths) {
+ if (!fetchQmldir(QUrl(qmldirPath), import, ++priority, errors))
+ return false;
}
}
}
@@ -2260,7 +2249,10 @@ void QQmlTypeData::allDependenciesDone()
for ( ; it != end; ++it) {
if (*it == 0) {
// This import was not resolved
- foreach (const QV4::CompiledData::Import *import, m_unresolvedImports.keys()) {
+ for (auto keyIt = m_unresolvedImports.keyBegin(),
+ keyEnd = m_unresolvedImports.keyEnd();
+ keyIt != keyEnd; ++keyIt) {
+ const QV4::CompiledData::Import *import = *keyIt;
QQmlError error;
error.setDescription(QQmlTypeLoader::tr("module \"%1\" is not installed").arg(stringAt(import->uriIndex)));
error.setUrl(m_importCache.baseUrl());
@@ -2574,6 +2566,7 @@ QV4::ReturnedValue QQmlScriptData::scriptValueForContext(QQmlContextData *parent
if (!m_program) {
if (shared)
m_loaded = true;
+ ctxt->destroy();
return QV4::Encode::undefined();
}