diff options
author | Ulf Hermann <[email protected]> | 2021-03-24 17:33:43 +0100 |
---|---|---|
committer | Ulf Hermann <[email protected]> | 2021-03-25 11:31:09 +0100 |
commit | 8fe127129b4f31e7e13dbf727687d98b95984763 (patch) | |
tree | e43d2f018d4feee2381d63e12714fd858cad0d97 /src/qml/jsruntime/qv4engine_p.h | |
parent | fc636af3a723ee8b4ee42cf71864ae0df5ca4621 (diff) |
Inline retrieval of QML contexts
In the good case this is just reading a few members of the relevant
classes. No need to call functions for this.
Change-Id: I9908cd6437cf9a1ca840f9aa0e524d3976272d67
Reviewed-by: Fabian Kosmale <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4engine_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 1ec5eb126a..ac095d2812 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -626,6 +626,25 @@ public: Heap::Object *newMapIteratorObject(Object *o); Heap::Object *newArrayIteratorObject(Object *o); + static Heap::ExecutionContext *qmlContext(Heap::ExecutionContext *ctx) + { + Heap::ExecutionContext *outer = ctx->outer; + + if (ctx->type != Heap::ExecutionContext::Type_QmlContext && !outer) + return nullptr; + + while (outer && outer->type != Heap::ExecutionContext::Type_GlobalContext) { + ctx = outer; + outer = ctx->outer; + } + + Q_ASSERT(ctx); + if (ctx->type != Heap::ExecutionContext::Type_QmlContext) + return nullptr; + + return ctx; + } + Heap::QmlContext *qmlContext() const; QObject *qmlScopeObject() const; QQmlRefPointer<QQmlContextData> callingQmlContext() const; |