diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-08-09 15:46:38 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-08-10 12:44:12 +0000 |
commit | 9425f832cdc036818cb08d1bd1328345fcb6f2ff (patch) | |
tree | 67f81cfa1b1637b856f5d7072690e252e1ac41a8 /src/qml/compiler/qv4compilationunitmapper.cpp | |
parent | 3d618b58b4f138717dffc81c9c421fe4398dd30c (diff) |
Enable disk caching on Windows
In order to enable the disk cache we need to replace the QFile::map
usage with direct win32 file API calls in order to create executable
file mappings. The files opened with QFile lack GENERIC_EXECUTE in
the open flags.
The code remains disabled on WinRT for now.
Change-Id: I7d12267755a9de0344ac087b2ff67140531d9df0
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilationunitmapper.cpp')
-rw-r--r-- | src/qml/compiler/qv4compilationunitmapper.cpp | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/qml/compiler/qv4compilationunitmapper.cpp b/src/qml/compiler/qv4compilationunitmapper.cpp index 084137f17f..b53b7cf784 100644 --- a/src/qml/compiler/qv4compilationunitmapper.cpp +++ b/src/qml/compiler/qv4compilationunitmapper.cpp @@ -86,44 +86,4 @@ bool CompilationUnitMapper::verifyHeader(const CompiledData::Unit *header, const return true; } -#if !defined(Q_OS_UNIX) -CompiledData::Unit *CompilationUnitMapper::open(const QString &sourcePath, QString *errorString) -{ - close(); - - f.setFileName(sourcePath + QLatin1Char('c')); - if (!f.open(QIODevice::ReadOnly)) { - *errorString = f.errorString(); - return nullptr; - } - - CompiledData::Unit header; - qint64 bytesRead = f.read(reinterpret_cast<char *>(&header), sizeof(header)); - - if (bytesRead != sizeof(header)) { - *errorString = QStringLiteral("File too small for the header fields"); - return nullptr; - } - - if (!verifyHeader(&header, sourcePath, errorString)) - return nullptr; - - // Data structure and qt version matched, so now we can access the rest of the file safely. - - dataPtr = f.map(/*offset*/0, f.size()); - if (!dataPtr) { - *errorString = f.errorString(); - return nullptr; - } - - return reinterpret_cast<CompiledData::Unit*>(dataPtr); -} - -void CompilationUnitMapper::close() -{ - f.close(); - dataPtr = nullptr; -} -#endif // !defined(Q_OS_UNIX) - QT_END_NAMESPACE |