diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-07-02 10:28:57 +0200 |
---|---|---|
committer | Jaeyoon Jung <jaeyoon.jung@lge.com> | 2021-07-21 10:44:45 +0900 |
commit | 75ca259e523973b674b6a978d7c2284f5dc1ef9f (patch) | |
tree | 6f1ae8833f0c8b399e179d84484318742e12a848 | |
parent | 0c769794d848ef004494be2ab6ac88bdbec366ad (diff) |
Completely cache the result of qmldir searches
Change-Id: Ib6a41c8d20b1443d8d4296190c007f4627086602
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c1d55e0de6cc26a0b7473a9e5c49753a8ac27d14)
Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
-rw-r--r-- | src/qml/qml/qqmlimport_p.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlimport_p.h b/src/qml/qml/qqmlimport_p.h index bbf279780d..f92c2f7c38 100644 --- a/src/qml/qml/qqmlimport_p.h +++ b/src/qml/qml/qqmlimport_p.h @@ -286,8 +286,11 @@ QQmlImportDatabase::LocalQmldirResult QQmlImportDatabase::locateLocalQmldir( QmldirCache *cache = cacheHead; while (cache) { if (cache->version == version) { - if (cache->qmldirFilePath.isEmpty()) - return QmldirNotFound; + if (cache->qmldirFilePath.isEmpty()) { + return cache->qmldirPathUrl.isEmpty() + ? QmldirNotFound + : QmldirInterceptedToRemote; + } if (callback(cache->qmldirFilePath, cache->qmldirPathUrl)) return QmldirFound; result = QmldirRejected; @@ -361,10 +364,15 @@ QQmlImportDatabase::LocalQmldirResult QQmlImportDatabase::locateLocalQmldir( } // Nothing found? Add an empty cache entry to signal that for further requests. - if (result == QmldirNotFound) { + if (result == QmldirNotFound || result == QmldirInterceptedToRemote) { QmldirCache *cache = new QmldirCache; cache->version = version; cache->next = cacheHead; + if (result == QmldirInterceptedToRemote) { + // The actual value doesn't matter as long as it's not empty. + // We only use it to discern QmldirInterceptedToRemote from QmldirNotFound above. + cache->qmldirPathUrl = QStringLiteral("intercepted"); + } qmldirCache.insert(uri, cache); } |