diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-13 14:11:55 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-18 13:14:03 +0200 |
commit | 49aead7f236f8b8a6ab85adc4b5eace1c1e4dde6 (patch) | |
tree | 21b01c30b568bd79176a5dfe4ec2437e2545660e /src/qml/jsruntime/qv4functionobject_p.h | |
parent | 2a43ec129a544d80c9cc3266b5eccce0f6ba66ef (diff) |
Extend the ReturnedValue mechanism to pointers to Managed objects
Add a Returned<T> that we can return instead of raw pointers
to Managed objects.
Start using the Returned<T> for a few methods.
Also clean up all our classes to use the Q_MANAGED macro instead
of manually defining their vtable.
Change-Id: I0a2962e47f3de955cd2cd8474f8f3fcc9e36d084
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject_p.h | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index 37f9d0bf46..333b95ad74 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -93,6 +93,7 @@ struct InternalClass; struct Lookup; struct Q_QML_EXPORT FunctionObject: Object { + Q_MANAGED // Used with Managed::subType enum FunctionType { RegularFunction = 0, @@ -135,7 +136,6 @@ struct Q_QML_EXPORT FunctionObject: Object { protected: FunctionObject(InternalClass *ic); - static const ManagedVTable static_vtbl; static void markObjects(Managed *that); static bool hasInstance(Managed *that, const Value &value); static void destroy(Managed *that) @@ -144,13 +144,11 @@ protected: struct FunctionCtor: FunctionObject { + Q_MANAGED FunctionCtor(ExecutionContext *scope); static ReturnedValue construct(Managed *that, CallData *callData); static ReturnedValue call(Managed *that, CallData *callData); - -protected: - static const ManagedVTable static_vtbl; }; struct FunctionPrototype: FunctionObject @@ -165,15 +163,13 @@ struct FunctionPrototype: FunctionObject }; struct BuiltinFunction: FunctionObject { + Q_MANAGED ReturnedValue (*code)(SimpleCallContext *); BuiltinFunction(ExecutionContext *scope, String *name, ReturnedValue (*code)(SimpleCallContext *)); static ReturnedValue construct(Managed *, CallData *); static ReturnedValue call(Managed *that, CallData *callData); - -protected: - static const ManagedVTable static_vtbl; }; struct IndexedBuiltinFunction: FunctionObject @@ -203,26 +199,23 @@ struct IndexedBuiltinFunction: FunctionObject struct ScriptFunction: FunctionObject { + Q_MANAGED ScriptFunction(ExecutionContext *scope, Function *function); static ReturnedValue construct(Managed *, CallData *callData); static ReturnedValue call(Managed *that, CallData *callData); - -protected: - static const ManagedVTable static_vtbl; }; struct SimpleScriptFunction: FunctionObject { + Q_MANAGED SimpleScriptFunction(ExecutionContext *scope, Function *function); static ReturnedValue construct(Managed *, CallData *callData); static ReturnedValue call(Managed *that, CallData *callData); - -protected: - static const ManagedVTable static_vtbl; }; struct BoundFunction: FunctionObject { + Q_MANAGED FunctionObject *target; Value boundThis; QVector<Value> boundArgs; @@ -234,7 +227,6 @@ struct BoundFunction: FunctionObject { static ReturnedValue construct(Managed *, CallData *d); static ReturnedValue call(Managed *that, CallData *dd); - static const ManagedVTable static_vtbl; static void destroy(Managed *); static void markObjects(Managed *that); static bool hasInstance(Managed *that, const Value &value); |