From d77e544a568dbfff698c4d37c669bc991383fe9b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 28 Jul 2016 17:40:36 +0200 Subject: Safeguard disk cache loading with checksum verification When loading a QML component from the disk cache, compare the checksum of the dependent types against the checksum when the cache was created. Any change in the meta-object of a dependent type should trigger a re-creation discard of the cache and consequent re-creation (in the test-case). Unfortunately this also requires extending the existing hack in the unit test to deal with the low second precision on HFS+ in order to pass the tests. Change-Id: Ib8e899347680f7be676788388e9c23a09b0277e3 Reviewed-by: Ulf Hermann --- src/qml/qml/qqmltypeloader_p.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/qml/qml/qqmltypeloader_p.h') diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h index 5f754df1fc..cfbaa2e92b 100644 --- a/src/qml/qml/qqmltypeloader_p.h +++ b/src/qml/qml/qqmltypeloader_p.h @@ -442,18 +442,24 @@ protected: private: bool tryLoadFromDiskCache(); + bool loadFromSource(); void continueLoadFromIR(); void resolveTypes(); QQmlCompileError buildTypeResolutionCaches( QQmlRefPointer *importCache, QV4::CompiledData::ResolvedTypeReferenceMap *resolvedTypeCache ) const; - void compile(); - void rebuildTypeAndPropertyCaches(); + void compile(const QQmlRefPointer &importCache, + const QV4::CompiledData::ResolvedTypeReferenceMap &resolvedTypeCache); + void createTypeAndPropertyCaches(const QQmlRefPointer &importCache, + const QV4::CompiledData::ResolvedTypeReferenceMap &resolvedTypeCache); bool resolveType(const QString &typeName, int &majorVersion, int &minorVersion, TypeReference &ref); virtual void scriptImported(QQmlScriptBlob *blob, const QV4::CompiledData::Location &location, const QString &qualifier, const QString &nameSpace); + + qint64 m_sourceTimeStamp = 0; + QByteArray m_backupSourceCode; // used when cache verification fails. QScopedPointer m_document; QV4::CompiledData::TypeReferenceMap m_typeReferences; -- cgit v1.2.3