diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-05-11 17:20:40 +1000 |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-06-06 11:50:48 +1000 |
commit | 6b54de600ce74025bc8ada20bea95ad183a6cd8d (patch) | |
tree | 6736888525cd8cd8c2d30bb7b87b3249b74839a5 /src/declarative/qml/qdeclarativeexpression_p.h | |
parent | 6dbd4286eb19e9ac45665046a43342bcdc8b127e (diff) |
Initial V8 integration
Diffstat (limited to 'src/declarative/qml/qdeclarativeexpression_p.h')
-rw-r--r-- | src/declarative/qml/qdeclarativeexpression_p.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/declarative/qml/qdeclarativeexpression_p.h b/src/declarative/qml/qdeclarativeexpression_p.h index 51cae0f9d4..04cbdad415 100644 --- a/src/declarative/qml/qdeclarativeexpression_p.h +++ b/src/declarative/qml/qdeclarativeexpression_p.h @@ -60,6 +60,8 @@ #include <QtScript/qscriptvalue.h> +#include <private/qv8engine_p.h> + QT_BEGIN_NAMESPACE class QDeclarativeAbstractExpression @@ -124,7 +126,8 @@ public: QString expression; Mode expressionFunctionMode; - QScriptValue expressionFunction; + v8::Persistent<v8::Function> v8function; + v8::Persistent<v8::Object> v8qmlscope; QScriptValue expressionContext; // Only used in ExplicitContext QObject *scopeObject; // Only used in SharedContext @@ -137,7 +140,7 @@ public: void setEvaluateFlags(EvaluateFlags flags); EvaluateFlags evaluateFlags() const; - QScriptValue scriptValue(QObject *secondaryScope, bool *isUndefined); + v8::Local<v8::Value> v8value(QObject *secondaryScope, bool *isUndefined); class DeleteWatcher { public: @@ -152,7 +155,7 @@ public: private: void clearGuards(); - QScriptValue eval(QObject *secondaryScope, bool *isUndefined); + v8::Local<v8::Value> eval(QObject *secondaryScope, bool *isUndefined); void updateGuards(const QPODVector<QDeclarativeEnginePrivate::CapturedProperty> &properties); bool trackChange; @@ -180,11 +183,12 @@ public: ~QDeclarativeExpressionPrivate(); void init(QDeclarativeContextData *, const QString &, QObject *); - void init(QDeclarativeContextData *, const QScriptValue &, QObject *); + void init(QDeclarativeContextData *, v8::Handle<v8::Function>, QObject *); void init(QDeclarativeContextData *, void *, QDeclarativeRefCount *, QObject *, const QString &, int); QVariant value(QObject *secondaryScope = 0, bool *isUndefined = 0); - QScriptValue scriptValue(QObject *secondaryScope = 0, bool *isUndefined = 0); + + v8::Local<v8::Value> v8value(QObject *secondaryScope = 0, bool *isUndefined = 0); static QDeclarativeExpressionPrivate *get(QDeclarativeExpression *expr) { return static_cast<QDeclarativeExpressionPrivate *>(QObjectPrivate::get(expr)); @@ -197,11 +201,16 @@ public: virtual void emitValueChanged(); static void exceptionToError(QScriptEngine *, QDeclarativeError &); + static void exceptionToError(v8::Handle<v8::Message>, QDeclarativeError &); static QScriptValue evalInObjectScope(QDeclarativeContextData *, QObject *, const QString &, const QString &, int, QScriptValue *); static QScriptValue evalInObjectScope(QDeclarativeContextData *, QObject *, const QScriptProgram &, QScriptValue *); + static v8::Persistent<v8::Function> evalFunction(QDeclarativeContextData *ctxt, QObject *scope, + const QString &code, const QString &filename, int line, + v8::Persistent<v8::Object> *qmlscope = 0); + bool expressionFunctionValid:1; QString url; // This is a QString for a reason. QUrls are slooooooow... |