diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-08-12 12:15:47 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-08-20 20:01:18 +0000 |
commit | cc98678f404cd49750076795f39b31bfa36c80c3 (patch) | |
tree | 33093822563101f6bdaed5e71677940f01624971 /src/qml/qml/v8/qv8engine_p.h | |
parent | 6dda1b425867b76fb001b11f43836c56e24ab7a4 (diff) |
Use the QmlContext as the scope for QQmlV4Function calls
This further reduces our dependency on the QQmlContextWrapper
and reduces storage requirements in the QObjectMethod.
Change-Id: I2c12d0a8818d81d45139f482caac8510ad8dfddc
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/qml/v8/qv8engine_p.h')
-rw-r--r-- | src/qml/qml/v8/qv8engine_p.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h index 5d12244dcb..08bbbb8548 100644 --- a/src/qml/qml/v8/qv8engine_p.h +++ b/src/qml/qml/v8/qv8engine_p.h @@ -63,6 +63,7 @@ #include <private/qv4value_p.h> #include <private/qv4object_p.h> #include <private/qv4identifier_p.h> +#include <private/qqmlcontextwrapper_p.h> QT_BEGIN_NAMESPACE @@ -119,8 +120,8 @@ class QQmlV4Function public: int length() const { return callData->argc; } QV4::ReturnedValue operator[](int idx) { return (idx < callData->argc ? callData->args[idx].asReturnedValue() : QV4::Encode::undefined()); } - QQmlContextData *context() { return ctx; } - QV4::ReturnedValue qmlGlobal() { return callData->thisObject.asReturnedValue(); } + QQmlContextData *context() { return e->qmlContextObject()->context.contextData(); } + QV4::ReturnedValue qmlGlobal() { return e->qmlContextObject()->asReturnedValue(); } void setReturnValue(QV4::ReturnedValue rv) { *retVal = rv; } QV4::ExecutionEngine *v4engine() const { return e; } private: @@ -129,16 +130,14 @@ private: QQmlV4Function(const QQmlV4Function &); QQmlV4Function &operator=(const QQmlV4Function &); - QQmlV4Function(QV4::CallData *callData, QV4::Value *retVal, - const QV4::Value &global, QQmlContextData *c, QV4::ExecutionEngine *e) - : callData(callData), retVal(retVal), ctx(c), e(e) + QQmlV4Function(QV4::CallData *callData, QV4::Value *retVal, QV4::ExecutionEngine *e) + : callData(callData), retVal(retVal), e(e) { - callData->thisObject = QV4::Value::fromReturnedValue(global.asReturnedValue()); + callData->thisObject = QV4::Encode::undefined(); } QV4::CallData *callData; QV4::Value *retVal; - QQmlContextData *ctx; QV4::ExecutionEngine *e; }; |