diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-05-04 08:32:45 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-17 08:58:45 +0200 |
commit | 43a6cc75886c662e63db440dd191cefa1fe956f3 (patch) | |
tree | cd3247453a0c2a59e0c5d3af11434d18761c2de4 /src/qml/qml/qqmlengine_p.h | |
parent | 9af1a7d0aee4f9ed48b2519779388830a8dd03e9 (diff) |
Add QQmlEngine::trimComponentCache()
Allow unused data in the engine's component cache to be safely discarded
so that the memory can be freed for other purposes.
Unloading of scripts that are no longer required after trimming unused
components is not yet supported.
Task-number: QTBUG-25653
Change-Id: I37bc9d5592eeb5edceeb34d010a555dcffd11cea
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlengine_p.h')
-rw-r--r-- | src/qml/qml/qqmlengine_p.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h index 4c6b3b5f0f..d3e7bc2e4d 100644 --- a/src/qml/qml/qqmlengine_p.h +++ b/src/qml/qml/qqmlengine_p.h @@ -239,7 +239,14 @@ public: int listType(int) const; const QMetaObject *rawMetaObjectForType(int) const; const QMetaObject *metaObjectForType(int) const; - void registerCompositeType(QQmlCompiledData *); + void registerCompositeType(const QMetaObject *); + void unregisterCompositeType(const QMetaObject *); + + void clearCache(); + void trimCache(); + + bool isTypeLoaded(const QUrl &url) const; + bool isScriptLoaded(const QUrl &url) const; inline void setDebugChangesCache(const QHash<QUrl, QByteArray> &changes); inline QHash<QUrl, QByteArray> debugChangesCache(); @@ -295,13 +302,15 @@ private: QQmlPropertyCache *createCache(const QMetaObject *); QQmlPropertyCache *createCache(QQmlType *, int, QQmlError &error); + void typeUnloaded(QQmlTypeData *typeData); + // These members must be protected by a QQmlEnginePrivate::Locker as they are required by // the threaded loader. Only access them through their respective accessor methods. QHash<QQmlMetaType::ModuleApi, QQmlMetaType::ModuleApiInstance *> moduleApiInstances; QHash<const QMetaObject *, QQmlPropertyCache *> propertyCache; QHash<QPair<QQmlType *, int>, QQmlPropertyCache *> typePropertyCache; QHash<int, int> m_qmlLists; - QHash<int, QQmlCompiledData *> m_compositeTypes; + QHash<int, const QMetaObject *> m_compositeTypes; QHash<QUrl, QByteArray> debugChangesHash; // These members is protected by the full QQmlEnginePrivate::mutex mutex |