aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4objectiterator_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-30 13:48:05 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-02 16:07:33 +0200
commit430dfd326cb9d8dab8ebd11e83dd52e6d55c4229 (patch)
tree0d1dd82ddf8f027a591e93def6ce369237af725a /src/qml/jsruntime/qv4objectiterator_p.h
parent3dc090fc1eb0a810d96ffc87e4662f7eb9ac8fd2 (diff)
Fix ObjectIterator API to be GC safe
Change-Id: I3a9c48d53d8dbadcb9b32c00fcef1f89447c4b8c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4objectiterator_p.h')
-rw-r--r--src/qml/jsruntime/qv4objectiterator_p.h34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4objectiterator_p.h b/src/qml/jsruntime/qv4objectiterator_p.h
index d5464891f1..e38fa8d7b6 100644
--- a/src/qml/jsruntime/qv4objectiterator_p.h
+++ b/src/qml/jsruntime/qv4objectiterator_p.h
@@ -43,6 +43,8 @@
#include "qv4global_p.h"
#include "qv4property_p.h"
+#include "qv4scopedvalue_p.h"
+#include "qv4object_p.h"
QT_BEGIN_NAMESPACE
@@ -65,8 +67,8 @@ struct Q_QML_EXPORT ObjectIterator
WithProtoChain = 0x2,
};
- Object *object;
- Object *current;
+ ObjectRef object;
+ ObjectRef current;
SparseArrayNode *arrayNode;
uint arrayIndex;
uint memberIndex;
@@ -74,12 +76,32 @@ struct Q_QML_EXPORT ObjectIterator
Property tmpDynamicProperty;
- ObjectIterator(Object *o, uint flags);
- Property *next(String **name, uint *index, PropertyAttributes *attributes = 0);
- ReturnedValue nextPropertyName(Value *value = 0);
- ReturnedValue nextPropertyNameAsString(Value *value = 0);
+ ObjectIterator(SafeObject *scratch1, SafeObject *scratch2, const ObjectRef o, uint flags);
+ ObjectIterator(Scope &scope, const ObjectRef o, uint flags);
+ Property *next(StringRef name, uint *index, PropertyAttributes *attributes = 0);
+ ReturnedValue nextPropertyName(ValueRef value);
+ ReturnedValue nextPropertyNameAsString(ValueRef value);
+ ReturnedValue nextPropertyNameAsString();
};
+struct ForEachIteratorObject: Object {
+ Q_MANAGED
+ ObjectIterator it;
+ ForEachIteratorObject(ExecutionContext *ctx, const ObjectRef o)
+ : Object(ctx->engine), it(workArea, workArea + 1, o, ObjectIterator::EnumerableOnly|ObjectIterator::WithProtoChain) {
+ vtbl = &static_vtbl;
+ type = Type_ForeachIteratorObject;
+ }
+
+ ReturnedValue nextPropertyName() { return it.nextPropertyNameAsString(); }
+
+protected:
+ static void markObjects(Managed *that);
+
+ SafeObject workArea[2];
+};
+
+
}
QT_END_NAMESPACE