diff options
Diffstat (limited to 'src/quicktestutils/qml/qmlutils.cpp')
| -rw-r--r-- | src/quicktestutils/qml/qmlutils.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/quicktestutils/qml/qmlutils.cpp b/src/quicktestutils/qml/qmlutils.cpp index 05d94b68ae..6cc54af356 100644 --- a/src/quicktestutils/qml/qmlutils.cpp +++ b/src/quicktestutils/qml/qmlutils.cpp @@ -7,6 +7,7 @@ #include <QtCore/QMutexLocker> #include <QtQml/QQmlComponent> #include <QtQml/QQmlEngine> +#include <private/qqmlengine_p.h> QT_BEGIN_NAMESPACE @@ -109,6 +110,34 @@ QQmlTestMessageHandler::~QQmlTestMessageHandler() QQmlTestMessageHandler::m_instance = nullptr; } + +bool gcDone(const QV4::ExecutionEngine *engine) { + // always true as long as the gc is non-incremental + Q_UNUSED(engine); + return true; +} + +void gc(QV4::ExecutionEngine &engine, GCFlags flags) +{ + engine.memoryManager->runGC(); + if (int(GCFlags::DontSendPostedEvents) & int(flags)) + return; + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); + QCoreApplication::processEvents(); +} + +bool gcDone(QQmlEngine *engine) { + auto priv = QQmlEnginePrivate::get(engine); + return gcDone(priv->v4engine()); +} + +void gc(QQmlEngine &engine, GCFlags flags) +{ + auto priv = QQmlEnginePrivate::get(&engine); + gc(*priv->v4engine(), flags); +} + + QT_END_NAMESPACE #include "moc_qmlutils_p.cpp" |
