From b6d3bae80317d854d78b5880d8d46cacd0d1a64e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 15 Sep 2014 21:48:30 +0200 Subject: QtDeclarative fixes and workarounds for NaCl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make QtDeclarative run on Native Client. Some of these should be looked at more closely at a later point in time, but will do as workarounds from now. Change-Id: Ifddcb45b190c3a80c6137772a05ababb5466ea22 Reviewed-by: Morten Johan Sørvig --- src/qml/qml/qqmldirparser.cpp | 4 ++++ src/qml/qml/qqmlimport.cpp | 11 +++++++++++ src/qml/qml/qqmltypeloader.cpp | 5 +++++ src/qml/qml/v8/qv8engine.cpp | 3 +++ 4 files changed, 23 insertions(+) (limited to 'src/qml/qml') diff --git a/src/qml/qml/qqmldirparser.cpp b/src/qml/qml/qqmldirparser.cpp index 57b50733ea..ca3e620996 100644 --- a/src/qml/qml/qqmldirparser.cpp +++ b/src/qml/qml/qqmldirparser.cpp @@ -100,6 +100,10 @@ bool QQmlDirParser::parse(const QString &source) _plugins.clear(); _components.clear(); _scripts.clear(); +#ifdef Q_OS_NACL + // ### Work around "only one module identifier" error below + _typeNamespace.clear(); +#endif _designerSupported = false; quint16 lineNumber = 0; diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index d538199520..10cb377929 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1206,6 +1206,10 @@ bool QQmlImportsPrivate::validateQmldirVersion(const QQmlTypeLoader::QmldirConte } } +#ifdef Q_OS_NACL + // ### This check triggers on NaCl: lowest_min/highest_min do not + // get set to senisble values. Disabling allows loading to continue. +#else if (lowest_min > vmin || highest_min < vmin) { QQmlError error; error.setDescription(QQmlImportDatabase::tr("module \"%1\" version %2.%3 is not installed").arg(uri).arg(vmaj).arg(vmin)); @@ -1213,6 +1217,7 @@ bool QQmlImportsPrivate::validateQmldirVersion(const QQmlTypeLoader::QmldirConte return false; } +#endif return true; } @@ -1565,7 +1570,13 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e) // Search order is applicationDirPath(), $QML2_IMPORT_PATH, QLibraryInfo::Qml2ImportsPath +#ifdef Q_OS_NACL + // Hardcode the qml imports to "qml/" relative to the app nexe. + // This should perhaps be set via Qml2Imports in qt.conf. + QString installImportsPath = QStringLiteral("qml/"); +#else QString installImportsPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath); +#endif addImportPath(installImportsPath); // env import paths diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 1e671542be..dd6de8f9b3 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -1706,9 +1706,14 @@ Returns a QQmlQmldirData for \a url. The QQmlQmldirData may be cached. */ QQmlQmldirData *QQmlTypeLoader::getQmldir(const QUrl &url) { +#ifdef Q_OS_NACL + // ### NaCl asserts here on urls like "qml/QtQuick.2.1/qmldir", + // which are relative urls we want to load over the network. +#else Q_ASSERT(!url.isRelative() && (QQmlFile::urlToLocalFileOrQrc(url).isEmpty() || !QDir::isRelativePath(QQmlFile::urlToLocalFileOrQrc(url)))); +#endif LockHolder holder(this); diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index dae932e705..0915b8f80b 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -123,10 +123,13 @@ QV8Engine::QV8Engine(QJSEngine* qq) , m_xmlHttpRequestData(0) , m_listModelData(0) { + +#ifndef Q_OS_NACL #ifdef Q_PROCESSOR_X86_32 if (!qCpuHasFeature(SSE2)) { qFatal("This program requires an X86 processor that supports SSE2 extension, at least a Pentium 4 or newer"); } +#endif #endif QML_MEMORY_SCOPE_STRING("QV8Engine::QV8Engine"); -- cgit v1.2.3