summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-12-23 06:50:51 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-12-23 06:50:51 (GMT)
commit411e60e45a779d8c80e70daee2bff9a1306f98db (patch)
treee13612b939e5b59fce776913ff09815425532958
parent40477f47685a2745cb591bde5669338a4a0a70eb (diff)
parent92c50014c0cdca68f342597fb037942960852009 (diff)
downloadQt-411e60e45a779d8c80e70daee2bff9a1306f98db.zip
Qt-411e60e45a779d8c80e70daee2bff9a1306f98db.tar.gz
Qt-411e60e45a779d8c80e70daee2bff9a1306f98db.tar.bz2
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsanchors.cpp8
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsanchors_p.h1
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp10
-rw-r--r--src/declarative/qml/qmlbindingvme.cpp333
-rw-r--r--src/declarative/qml/qmlbindingvme_p.h3
-rw-r--r--src/declarative/qml/qmlcontext_p.h6
-rw-r--r--src/declarative/qml/qmlcontextscriptclass.cpp5
-rw-r--r--src/declarative/qml/qmldeclarativedata_p.h36
-rw-r--r--src/declarative/qml/qmlengine.cpp20
-rw-r--r--src/declarative/qml/qmlexpression_p.h9
-rw-r--r--src/declarative/qml/qmlguard_p.h154
-rw-r--r--src/declarative/qml/qmllistscriptclass.cpp3
-rw-r--r--src/declarative/qml/qmlmetaproperty_p.h3
-rw-r--r--src/declarative/qml/qmlobjectscriptclass.cpp5
-rw-r--r--src/declarative/qml/qmlvaluetypescriptclass.cpp3
-rw-r--r--src/declarative/qml/qmlvmemetaobject_p.h4
-rw-r--r--src/declarative/util/qmlpropertychanges.cpp3
-rw-r--r--src/declarative/util/qmlstate_p_p.h6
-rw-r--r--src/declarative/util/qmlstateoperations.cpp5
-rw-r--r--tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml34
-rw-r--r--tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml41
-rw-r--r--tests/benchmarks/declarative/qmltime/tests/anchors/null.qml27
22 files changed, 530 insertions, 189 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp
index ddf2a3b..4948633 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp
@@ -50,7 +50,7 @@
QT_BEGIN_NAMESPACE
-QML_DEFINE_NOCREATE_TYPE(QmlGraphicsAnchors)
+QML_DEFINE_TYPE(Qt,4,6,Anchors,QmlGraphicsAnchors)
//TODO: should we cache relationships, so we don't have to check each time (parent-child or sibling)?
//TODO: support non-parent, non-sibling (need to find lowest common ancestor)
@@ -131,6 +131,12 @@ static qreal adjustedPosition(QmlGraphicsItem *item, QmlGraphicsAnchorLine::Anch
\warning Currently, only anchoring to siblings or parent is supported.
*/
+QmlGraphicsAnchors::QmlGraphicsAnchors(QObject *parent)
+ : QObject(*new QmlGraphicsAnchorsPrivate(0), parent)
+{
+ qFatal("QmlGraphicsAnchors::QmlGraphicsAnchors(QObject*) called");
+}
+
QmlGraphicsAnchors::QmlGraphicsAnchors(QmlGraphicsItem *item, QObject *parent)
: QObject(*new QmlGraphicsAnchorsPrivate(item), parent)
{
diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors_p.h b/src/declarative/graphicsitems/qmlgraphicsanchors_p.h
index dc6a7a8..5a8f8c1 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanchors_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsanchors_p.h
@@ -79,6 +79,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsAnchors : public QObject
Q_PROPERTY(QmlGraphicsItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged)
public:
+ QmlGraphicsAnchors(QObject *parent=0);
QmlGraphicsAnchors(QmlGraphicsItem *item, QObject *parent=0);
virtual ~QmlGraphicsAnchors();
diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
index 017a60c..b482db7 100644
--- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
@@ -52,6 +52,7 @@
#include <qmlinfo.h>
#include <qmldeclarativedata_p.h>
#include <qmlpropertycache_p.h>
+#include <qmlguard_p.h>
#include <qlistmodelinterface_p.h>
#include <qhash.h>
@@ -60,7 +61,6 @@
#include <QtCore/qdebug.h>
#include <private/qobject_p.h>
-#include <private/qguard_p.h>
QML_DECLARE_TYPE(QListModelInterface)
@@ -277,9 +277,9 @@ public:
return static_cast<QmlGraphicsVisualDataModelPrivate *>(QObjectPrivate::get(m));
}
- QGuard<QListModelInterface> m_listModelInterface;
- QGuard<QAbstractItemModel> m_abstractItemModel;
- QGuard<QmlGraphicsVisualDataModel> m_visualItemModel;
+ QmlGuard<QListModelInterface> m_listModelInterface;
+ QmlGuard<QAbstractItemModel> m_abstractItemModel;
+ QmlGuard<QmlGraphicsVisualDataModel> m_visualItemModel;
QString m_part;
QmlComponent *m_delegate;
@@ -434,7 +434,7 @@ Q_SIGNALS:
private:
friend class QmlGraphicsVisualDataModelDataMetaObject;
int m_index;
- QGuard<QmlGraphicsVisualDataModel> m_model;
+ QmlGuard<QmlGraphicsVisualDataModel> m_model;
QmlGraphicsVisualDataModelDataMetaObject *m_meta;
};
diff --git a/src/declarative/qml/qmlbindingvme.cpp b/src/declarative/qml/qmlbindingvme.cpp
index 552dd55..b4b8dc1 100644
--- a/src/declarative/qml/qmlbindingvme.cpp
+++ b/src/declarative/qml/qmlbindingvme.cpp
@@ -79,6 +79,7 @@ struct Register {
void *data[2]; // Object stored here
};
+// This structure is exactly 8-bytes in size
struct Instr {
enum {
Noop,
@@ -137,96 +138,128 @@ struct Instr {
FindProperty, // find
FindPropertyTerminal, // find
CleanupGeneric, // cleanup
- ConvertGenericToReal, // genericunaryop
- ConvertGenericToBool, // genericunaryop
- ConvertGenericToString, // genericunaryop
- ConvertGenericToUrl, // genericunaryop
-
- } type;
+ ConvertGenericToReal, // unaryop
+ ConvertGenericToBool, // unaryop
+ ConvertGenericToString, // unaryop
+ ConvertGenericToUrl, // unaryop
+ };
union {
struct {
- int subscriptions;
- int identifiers;
+ quint8 type;
+ quint8 packing[7];
+ } common;
+ struct {
+ quint8 type;
+ quint8 packing[3];
+ quint16 subscriptions;
+ quint16 identifiers;
} init;
struct {
- int offset;
- int reg;
- int index;
+ quint8 type;
+ qint8 reg;
+ quint16 offset;
+ quint32 index;
} subscribe;
struct {
- int index;
- int reg;
+ quint8 type;
+ qint8 reg;
+ quint8 packing[2];
+ quint32 index;
} load;
struct {
- int output;
- int reg;
- int index;
+ quint8 type;
+ qint8 output;
+ qint8 reg;
+ quint8 packing[1];
+ quint32 index;
} attached;
struct {
- int output;
- int reg;
- int index;
+ quint8 type;
+ qint8 output;
+ qint8 reg;
+ quint8 packing[1];
+ quint32 index;
} store;
struct {
- int output;
- int objectReg;
- int index;
+ quint8 type;
+ qint8 output;
+ qint8 objectReg;
+ quint8 packing[1];
+ quint32 index;
} fetch;
struct {
- int reg;
- int src;
+ quint8 type;
+ qint8 reg;
+ qint8 src;
+ quint8 packing[5];
} copy;
struct {
- int reg;
+ quint8 type;
+ qint8 reg;
+ quint8 packing[6];
} construct;
struct {
- int reg;
- qreal value;
+ quint8 type;
+ qint8 reg;
+ quint8 packing[2];
+ float value;
} real_value;
struct {
- int reg;
+ quint8 type;
+ qint8 reg;
+ quint8 packing[2];
int value;
} int_value;
struct {
- int reg;
+ quint8 type;
+ qint8 reg;
bool value;
+ quint8 packing[5];
} bool_value;
struct {
- int reg;
- int offset;
- int length;
+ quint8 type;
+ qint8 reg;
+ quint16 length;
+ quint32 offset;
} string_value;
struct {
- int output;
- int src1;
- int src2;
+ quint8 type;
+ qint8 output;
+ qint8 src1;
+ qint8 src2;
+ quint8 packing[4];
} binaryop;
struct {
- int output;
- int src;
+ quint8 type;
+ qint8 output;
+ qint8 src;
+ quint8 packing[5];
} unaryop;
struct {
- int output;
- int src;
- } genericunaryop;
- struct {
- int reg;
- int count;
+ quint8 type;
+ qint8 reg;
+ quint8 packing[2];
+ quint32 count;
} skip;
struct {
- int reg;
- int src;
- int name;
- int subscribeIndex;
+ quint8 type;
+ qint8 reg;
+ qint8 src;
+ quint8 packing[1];
+ quint16 name;
+ quint16 subscribeIndex;
} find;
struct {
- int reg;
+ quint8 type;
+ qint8 reg;
+ quint8 packing[6];
} cleanup;
struct {
- int offset;
- int dataIdx;
- int length;
+ quint8 type;
+ quint8 packing[1];
+ quint16 offset;
+ quint32 dataIdx;
} initstring;
};
};
@@ -633,7 +666,7 @@ void QmlBindingVME::run(const char *programData, int instrIndex,
while (instr) {
- switch (instr->type) {
+ switch (instr->common.type) {
case Instr::Noop:
break;
@@ -643,7 +676,7 @@ void QmlBindingVME::run(const char *programData, int instrIndex,
QObject *o = registers[instr->subscribe.reg].getQObject();
int notifyIndex = instr->subscribe.index;
- if (instr->type == Instr::SubscribeId) {
+ if (instr->common.type == Instr::SubscribeId) {
o = QmlContextPrivate::get(context);
notifyIndex += context->notifyIndex;
}
@@ -808,8 +841,11 @@ void QmlBindingVME::run(const char *programData, int instrIndex,
case Instr::InitString:
if (!config->identifiers[instr->initstring.offset].identifier) {
- QString str = QString::fromRawData((QChar *)(data + instr->initstring.dataIdx),
- instr->initstring.length);
+ quint32 len = *(quint32 *)(data + instr->initstring.dataIdx);
+ QChar *strdata = (QChar *)(data + instr->initstring.dataIdx + sizeof(quint32));
+
+ QString str = QString::fromRawData(strdata, len);
+
config->identifiers[instr->initstring.offset] =
engine->objectClass->createPersistentIdentifier(str);
}
@@ -823,7 +859,7 @@ void QmlBindingVME::run(const char *programData, int instrIndex,
if (!findgeneric(registers + instr->find.reg, config, instr->find.subscribeIndex,
QmlContextPrivate::get(context->parent),
config->identifiers[instr->find.name].identifier,
- instr->type == Instr::FindGenericTerminal)) {
+ instr->common.type == Instr::FindGenericTerminal)) {
qWarning() << "ERROR - FindGeneric*";
return;
}
@@ -835,7 +871,7 @@ void QmlBindingVME::run(const char *programData, int instrIndex,
QmlEnginePrivate::get(context->engine),
config, instr->find.subscribeIndex,
config->identifiers[instr->find.name].identifier,
- instr->type == Instr::FindPropertyTerminal)) {
+ instr->common.type == Instr::FindPropertyTerminal)) {
qWarning() << "ERROR - FindProperty*";
return;
}
@@ -852,31 +888,31 @@ void QmlBindingVME::run(const char *programData, int instrIndex,
case Instr::ConvertGenericToReal:
{
- int type = registers[instr->genericunaryop.src].gettype();
- registers[instr->genericunaryop.output].setqreal(toReal(registers + instr->genericunaryop.src, type));
+ int type = registers[instr->unaryop.src].gettype();
+ registers[instr->unaryop.output].setqreal(toReal(registers + instr->unaryop.src, type));
}
break;
case Instr::ConvertGenericToBool:
{
- int type = registers[instr->genericunaryop.src].gettype();
- registers[instr->genericunaryop.output].setbool(toBool(registers + instr->genericunaryop.src, type));
+ int type = registers[instr->unaryop.src].gettype();
+ registers[instr->unaryop.output].setbool(toBool(registers + instr->unaryop.src, type));
}
break;
case Instr::ConvertGenericToString:
{
- int type = registers[instr->genericunaryop.src].gettype();
- void *regPtr = registers[instr->genericunaryop.output].typeDataPtr();
- new (regPtr) QString(toString(registers + instr->genericunaryop.src, type));
+ int type = registers[instr->unaryop.src].gettype();
+ void *regPtr = registers[instr->unaryop.output].typeDataPtr();
+ new (regPtr) QString(toString(registers + instr->unaryop.src, type));
}
break;
case Instr::ConvertGenericToUrl:
{
- int type = registers[instr->genericunaryop.src].gettype();
- void *regPtr = registers[instr->genericunaryop.output].typeDataPtr();
- new (regPtr) QUrl(toUrl(registers + instr->genericunaryop.src, type, context));
+ int type = registers[instr->unaryop.src].gettype();
+ void *regPtr = registers[instr->unaryop.output].typeDataPtr();
+ new (regPtr) QUrl(toUrl(registers + instr->unaryop.src, type, context));
}
break;
@@ -903,7 +939,7 @@ void QmlBindingVME::dump(const char *programData)
while (count--) {
- switch (instr->type) {
+ switch (instr->common.type) {
case Instr::Noop:
qWarning().nospace() << "Noop";
break;
@@ -1007,7 +1043,7 @@ void QmlBindingVME::dump(const char *programData)
qWarning().nospace() << "Done";
break;
case Instr::InitString:
- qWarning().nospace() << "InitString" << "\t\t" << instr->initstring.offset << "\t" << instr->initstring.dataIdx << "\t" << instr->initstring.length;
+ qWarning().nospace() << "InitString" << "\t\t" << instr->initstring.offset << "\t" << instr->initstring.dataIdx;
break;
case Instr::FindGeneric:
qWarning().nospace() << "FindGeneric" << "\t\t" << instr->find.reg << "\t" << instr->find.name;
@@ -1025,16 +1061,16 @@ void QmlBindingVME::dump(const char *programData)
qWarning().nospace() << "CleanupGeneric" << "\t\t" << instr->cleanup.reg;
break;
case Instr::ConvertGenericToReal:
- qWarning().nospace() << "ConvertGenericToReal" << "\t" << instr->genericunaryop.output << "\t" << instr->genericunaryop.src;
+ qWarning().nospace() << "ConvertGenericToReal" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
break;
case Instr::ConvertGenericToBool:
- qWarning().nospace() << "ConvertGenericToBool" << "\t" << instr->genericunaryop.output << "\t" << instr->genericunaryop.src;
+ qWarning().nospace() << "ConvertGenericToBool" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
break;
case Instr::ConvertGenericToString:
- qWarning().nospace() << "ConvertGenericToString" << "\t" << instr->genericunaryop.output << "\t" << instr->genericunaryop.src;
+ qWarning().nospace() << "ConvertGenericToString" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
break;
case Instr::ConvertGenericToUrl:
- qWarning().nospace() << "ConvertGenericToUrl" << "\t" << instr->genericunaryop.output << "\t" << instr->genericunaryop.src;
+ qWarning().nospace() << "ConvertGenericToUrl" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
break;
default:
qWarning().nospace() << "Unknown";
@@ -1103,37 +1139,37 @@ bool QmlBindingCompilerPrivate::compile(QmlJS::AST::Node *node)
if (destination->type == QMetaType::QReal) {
Instr convert;
- convert.type = Instr::ConvertGenericToReal;
- convert.genericunaryop.output = convertReg;
- convert.genericunaryop.src = type.reg;
+ convert.common.type = Instr::ConvertGenericToReal;
+ convert.unaryop.output = convertReg;
+ convert.unaryop.src = type.reg;
bytecode << convert;
} else if (destination->type == QVariant::String) {
Instr convert;
- convert.type = Instr::ConvertGenericToString;
- convert.genericunaryop.output = convertReg;
- convert.genericunaryop.src = type.reg;
+ convert.common.type = Instr::ConvertGenericToString;
+ convert.unaryop.output = convertReg;
+ convert.unaryop.src = type.reg;
bytecode << convert;
} else if (destination->type == QMetaType::Bool) {
Instr convert;
- convert.type = Instr::ConvertGenericToBool;
- convert.genericunaryop.output = convertReg;
- convert.genericunaryop.src = type.reg;
+ convert.common.type = Instr::ConvertGenericToBool;
+ convert.unaryop.output = convertReg;
+ convert.unaryop.src = type.reg;
bytecode << convert;
} else if (destination->type == QVariant::Url) {
Instr convert;
- convert.type = Instr::ConvertGenericToUrl;
- convert.genericunaryop.output = convertReg;
- convert.genericunaryop.src = type.reg;
+ convert.common.type = Instr::ConvertGenericToUrl;
+ convert.unaryop.output = convertReg;
+ convert.unaryop.src = type.reg;
bytecode << convert;
}
Instr cleanup;
- cleanup.type = Instr::CleanupGeneric;
+ cleanup.common.type = Instr::CleanupGeneric;
cleanup.cleanup.reg = type.reg;
bytecode << cleanup;
Instr instr;
- instr.type = Instr::Store;
+ instr.common.type = Instr::Store;
instr.store.output = 0;
instr.store.index = destination->index;
instr.store.reg = convertReg;
@@ -1141,12 +1177,12 @@ bool QmlBindingCompilerPrivate::compile(QmlJS::AST::Node *node)
if (destination->type == QVariant::String) {
Instr cleanup;
- cleanup.type = Instr::CleanupString;
+ cleanup.common.type = Instr::CleanupString;
cleanup.cleanup.reg = convertReg;
bytecode << cleanup;
} else if (destination->type == QVariant::Url) {
Instr cleanup;
- cleanup.type = Instr::CleanupUrl;
+ cleanup.common.type = Instr::CleanupUrl;
cleanup.cleanup.reg = convertReg;
bytecode << cleanup;
}
@@ -1154,7 +1190,7 @@ bool QmlBindingCompilerPrivate::compile(QmlJS::AST::Node *node)
releaseReg(convertReg);
Instr done;
- done.type = Instr::Done;
+ done.common.type = Instr::Done;
bytecode << done;
return true;
@@ -1163,7 +1199,7 @@ bool QmlBindingCompilerPrivate::compile(QmlJS::AST::Node *node)
if (type.type == QVariant::Int &&
destination->type == QMetaType::QReal) {
Instr instr;
- instr.type = Instr::ConvertIntToReal;
+ instr.common.type = Instr::ConvertIntToReal;
instr.unaryop.output = type.reg;
instr.unaryop.src = type.reg;
bytecode << instr;
@@ -1171,7 +1207,7 @@ bool QmlBindingCompilerPrivate::compile(QmlJS::AST::Node *node)
} else if (type.type == QMetaType::QReal &&
destination->type == QVariant::Int) {
Instr instr;
- instr.type = Instr::ConvertRealToInt;
+ instr.common.type = Instr::ConvertRealToInt;
instr.unaryop.output = type.reg;
instr.unaryop.src = type.reg;
bytecode << instr;
@@ -1187,7 +1223,7 @@ bool QmlBindingCompilerPrivate::compile(QmlJS::AST::Node *node)
if (type.type == destination->type) {
Instr instr;
- instr.type = Instr::Store;
+ instr.common.type = Instr::Store;
instr.store.output = 0;
instr.store.index = destination->index;
instr.store.reg = type.reg;
@@ -1196,7 +1232,7 @@ bool QmlBindingCompilerPrivate::compile(QmlJS::AST::Node *node)
releaseReg(type.reg);
Instr done;
- done.type = Instr::Done;
+ done.common.type = Instr::Done;
bytecode << done;
return true;
@@ -1281,13 +1317,13 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
if (attachType) {
Instr instr;
- instr.type = Instr::LoadScope;
+ instr.common.type = Instr::LoadScope;
instr.load.index = 0;
instr.load.reg = reg;
bytecode << instr;
Instr attach;
- attach.type = Instr::LoadAttached;
+ attach.common.type = Instr::LoadAttached;
attach.attached.output = reg;
attach.attached.reg = reg;
attach.attached.index = attachType->index();
@@ -1309,19 +1345,19 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
// scope object to avoid a subscription
if (idObject == component) {
Instr instr;
- instr.type = Instr::LoadRoot;
+ instr.common.type = Instr::LoadRoot;
instr.load.index = 0;
instr.load.reg = reg;
bytecode << instr;
} else if (idObject == context) {
Instr instr;
- instr.type = Instr::LoadScope;
+ instr.common.type = Instr::LoadScope;
instr.load.index = 0;
instr.load.reg = reg;
bytecode << instr;
} else {
Instr instr;
- instr.type = Instr::LoadId;
+ instr.common.type = Instr::LoadId;
instr.load.index = idObject->idIndex;
instr.load.reg = reg;
bytecode << instr;
@@ -1330,7 +1366,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
if (subscription(subscribeName, &type)) {
Instr sub;
- sub.type = Instr::SubscribeId;
+ sub.common.type = Instr::SubscribeId;
sub.subscribe.offset = subscriptionIndex(subscribeName);
sub.subscribe.reg = reg;
sub.subscribe.index = instr.load.index;
@@ -1350,7 +1386,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
if (d0Idx != -1) {
Instr instr;
- instr.type = Instr::LoadScope;
+ instr.common.type = Instr::LoadScope;
instr.load.index = 0;
instr.load.reg = reg;
bytecode << instr;
@@ -1361,7 +1397,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
fetch(type, context->metaObject(), reg, d0Idx, subscribeName);
} else if(d1Idx != -1) {
Instr instr;
- instr.type = Instr::LoadRoot;
+ instr.common.type = Instr::LoadRoot;
instr.load.index = 0;
instr.load.reg = reg;
bytecode << instr;
@@ -1373,9 +1409,9 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
} else {
Instr find;
if (nameParts.count() == 1)
- find.type = Instr::FindGenericTerminal;
+ find.common.type = Instr::FindGenericTerminal;
else
- find.type = Instr::FindGeneric;
+ find.common.type = Instr::FindGeneric;
find.find.reg = reg;
find.find.src = -1;
@@ -1399,7 +1435,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
if (attachType) {
Instr attach;
- attach.type = Instr::LoadAttached;
+ attach.common.type = Instr::LoadAttached;
attach.attached.output = reg;
attach.attached.reg = reg;
attach.attached.index = attachType->index();
@@ -1435,9 +1471,9 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
Instr prop;
if (ii == nameParts.count() -1 )
- prop.type = Instr::FindPropertyTerminal;
+ prop.common.type = Instr::FindPropertyTerminal;
else
- prop.type = Instr::FindProperty;
+ prop.common.type = Instr::FindProperty;
prop.find.reg = reg;
prop.find.src = reg;
@@ -1508,7 +1544,7 @@ bool QmlBindingCompilerPrivate::numberArith(Result &type, const Result &lhs, con
if (nativeReal && lhs.type == QMetaType::Int) {
Instr convert;
- convert.type = Instr::ConvertIntToReal;
+ convert.common.type = Instr::ConvertIntToReal;
convert.unaryop.output = lhs.reg;
convert.unaryop.src = lhs.reg;
bytecode << convert;
@@ -1516,7 +1552,7 @@ bool QmlBindingCompilerPrivate::numberArith(Result &type, const Result &lhs, con
if (nativeReal && rhs.type == QMetaType::Int) {
Instr convert;
- convert.type = Instr::ConvertIntToReal;
+ convert.common.type = Instr::ConvertIntToReal;
convert.unaryop.output = rhs.reg;
convert.unaryop.src = rhs.reg;
bytecode << convert;
@@ -1528,9 +1564,9 @@ bool QmlBindingCompilerPrivate::numberArith(Result &type, const Result &lhs, con
lhsTmp = acquireReg();
Instr conv;
- conv.type = Instr::ConvertGenericToReal;
- conv.genericunaryop.output = lhsTmp;
- conv.genericunaryop.src = lhs.reg;
+ conv.common.type = Instr::ConvertGenericToReal;
+ conv.unaryop.output = lhsTmp;
+ conv.unaryop.src = lhs.reg;
bytecode << conv;
}
@@ -1538,17 +1574,17 @@ bool QmlBindingCompilerPrivate::numberArith(Result &type, const Result &lhs, con
rhsTmp = acquireReg();
Instr conv;
- conv.type = Instr::ConvertGenericToReal;
- conv.genericunaryop.output = rhsTmp;
- conv.genericunaryop.src = rhs.reg;
+ conv.common.type = Instr::ConvertGenericToReal;
+ conv.unaryop.output = rhsTmp;
+ conv.unaryop.src = rhs.reg;
bytecode << conv;
}
Instr arith;
if (op == QSOperator::Add) {
- arith.type = nativeReal?Instr::AddReal:Instr::AddInt;
+ arith.common.type = nativeReal?Instr::AddReal:Instr::AddInt;
} else if (op == QSOperator::Sub) {
- arith.type = nativeReal?Instr::MinusReal:Instr::MinusInt;
+ arith.common.type = nativeReal?Instr::MinusReal:Instr::MinusInt;
} else {
qFatal("Unsupported arithmetic operator");
}
@@ -1583,9 +1619,9 @@ bool QmlBindingCompilerPrivate::stringArith(Result &type, const Result &lhs, con
lhsTmp = acquireReg(Instr::CleanupString);
Instr convert;
- convert.type = Instr::ConvertGenericToString;
- convert.genericunaryop.output = lhsTmp;
- convert.genericunaryop.src = lhs.reg;
+ convert.common.type = Instr::ConvertGenericToString;
+ convert.unaryop.output = lhsTmp;
+ convert.unaryop.src = lhs.reg;
bytecode << convert;
}
@@ -1593,9 +1629,9 @@ bool QmlBindingCompilerPrivate::stringArith(Result &type, const Result &lhs, con
rhsTmp = acquireReg(Instr::CleanupString);
Instr convert;
- convert.type = Instr::ConvertGenericToString;
- convert.genericunaryop.output = rhsTmp;
- convert.genericunaryop.src = rhs.reg;
+ convert.common.type = Instr::ConvertGenericToString;
+ convert.unaryop.output = rhsTmp;
+ convert.unaryop.src = rhs.reg;
bytecode << convert;
}
@@ -1603,7 +1639,7 @@ bool QmlBindingCompilerPrivate::stringArith(Result &type, const Result &lhs, con
type.type = QMetaType::QString;
Instr add;
- add.type = Instr::AddString;
+ add.common.type = Instr::AddString;
add.binaryop.output = type.reg;
add.binaryop.src1 = (lhsTmp == -1)?lhs.reg:lhsTmp;
add.binaryop.src2 = (rhsTmp == -1)?rhs.reg:rhsTmp;
@@ -1647,11 +1683,11 @@ bool QmlBindingCompilerPrivate::parseLogic(QmlJS::AST::Node *node, Result &type)
Instr op;
if (expression->op == QSOperator::Gt)
- op.type = Instr::GreaterThanReal;
+ op.common.type = Instr::GreaterThanReal;
else if (expression->op == QSOperator::Equal)
- op.type = Instr::CompareReal;
+ op.common.type = Instr::CompareReal;
else if (expression->op == QSOperator::NotEqual)
- op.type = Instr::NotCompareReal;
+ op.common.type = Instr::NotCompareReal;
else
return false;
op.binaryop.output = type.reg;
@@ -1664,9 +1700,9 @@ bool QmlBindingCompilerPrivate::parseLogic(QmlJS::AST::Node *node, Result &type)
Instr op;
if (expression->op == QSOperator::Equal)
- op.type = Instr::CompareString;
+ op.common.type = Instr::CompareString;
else if (expression->op == QSOperator::NotEqual)
- op.type = Instr::NotCompareString;
+ op.common.type = Instr::NotCompareString;
else
return false;
op.binaryop.output = type.reg;
@@ -1704,7 +1740,7 @@ bool QmlBindingCompilerPrivate::parseConditional(QmlJS::AST::Node *node, Result
return false;
Instr skip;
- skip.type = Instr::Skip;
+ skip.common.type = Instr::Skip;
skip.skip.reg = etype.reg;
skip.skip.count = 0;
int skipIdx = bytecode.count();
@@ -1769,7 +1805,7 @@ bool QmlBindingCompilerPrivate::parseConstant(QmlJS::AST::Node *node, Result &ty
if (node->kind == AST::Node::Kind_TrueLiteral) {
type.type = QVariant::Bool;
Instr instr;
- instr.type = Instr::Bool;
+ instr.common.type = Instr::Bool;
instr.bool_value.reg = type.reg;
instr.bool_value.value = true;
bytecode << instr;
@@ -1777,17 +1813,22 @@ bool QmlBindingCompilerPrivate::parseConstant(QmlJS::AST::Node *node, Result &ty
} else if (node->kind == AST::Node::Kind_FalseLiteral) {
type.type = QVariant::Bool;
Instr instr;
- instr.type = Instr::Bool;
+ instr.common.type = Instr::Bool;
instr.bool_value.reg = type.reg;
instr.bool_value.value = false;
bytecode << instr;
return true;
} else if (node->kind == AST::Node::Kind_NumericLiteral) {
+ qreal value = qreal(static_cast<AST::NumericLiteral *>(node)->value);
+
+ if (qreal(float(value)) != value)
+ return false;
+
type.type = QMetaType::QReal;
Instr instr;
- instr.type = Instr::Real;
+ instr.common.type = Instr::Real;
instr.real_value.reg = type.reg;
- instr.real_value.value = qreal(static_cast<AST::NumericLiteral *>(node)->value);
+ instr.real_value.value = float(value);
bytecode << instr;
return true;
} else if (node->kind == AST::Node::Kind_StringLiteral) {
@@ -1837,9 +1878,9 @@ bool QmlBindingCompilerPrivate::parseMethod(QmlJS::AST::Node *node, Result &resu
Instr op;
if (method == QLatin1String("max")) {
- op.type = Instr::MaxReal;
+ op.common.type = Instr::MaxReal;
} else if (method == QLatin1String("min")) {
- op.type = Instr::MinReal;
+ op.common.type = Instr::MinReal;
} else {
return false;
}
@@ -1887,7 +1928,7 @@ bool QmlBindingCompilerPrivate::fetch(Result &rv, const QMetaObject *mo, int reg
if (subscription(subName, &rv) && prop.hasNotifySignal() && prop.notifySignalIndex() != -1) {
Instr sub;
- sub.type = Instr::Subscribe;
+ sub.common.type = Instr::Subscribe;
sub.subscribe.offset = subscriptionIndex(subName);
sub.subscribe.reg = reg;
sub.subscribe.index = prop.notifySignalIndex();
@@ -1895,7 +1936,7 @@ bool QmlBindingCompilerPrivate::fetch(Result &rv, const QMetaObject *mo, int reg
}
Instr fetch;
- fetch.type = Instr::Fetch;
+ fetch.common.type = Instr::Fetch;
fetch.fetch.objectReg = reg;
fetch.fetch.index = idx;
fetch.fetch.output = reg;
@@ -1907,7 +1948,7 @@ bool QmlBindingCompilerPrivate::fetch(Result &rv, const QMetaObject *mo, int reg
if (rv.type == QMetaType::QString) {
int tmp = acquireReg();
Instr copy;
- copy.type = Instr::Copy;
+ copy.common.type = Instr::Copy;
copy.copy.reg = tmp;
copy.copy.src = reg;
bytecode << copy;
@@ -1915,7 +1956,7 @@ bool QmlBindingCompilerPrivate::fetch(Result &rv, const QMetaObject *mo, int reg
fetch.fetch.objectReg = tmp;
Instr setup;
- setup.type = Instr::NewString;
+ setup.common.type = Instr::NewString;
setup.construct.reg = reg;
bytecode << setup;
registerCleanup(reg, Instr::CleanupString);
@@ -1965,7 +2006,7 @@ void QmlBindingCompilerPrivate::releaseReg(int reg)
QPair<int, int> c = registerCleanups[reg];
registerCleanups.remove(reg);
Instr cleanup;
- (int &)cleanup.type = c.first;
+ cleanup.common.type = (quint8)c.first;
cleanup.cleanup.reg = reg;
bytecode << cleanup;
}
@@ -1984,7 +2025,7 @@ int QmlBindingCompilerPrivate::registerLiteralString(const QString &str)
int reg = acquireReg(Instr::CleanupString);
Instr string;
- string.type = Instr::String;
+ string.common.type = Instr::String;
string.string_value.reg = reg;
string.string_value.offset = offset;
string.string_value.length = str.length();
@@ -2001,7 +2042,10 @@ int QmlBindingCompilerPrivate::registerString(const QString &string)
QHash<QString, QPair<int, int> >::ConstIterator iter = registeredStrings.find(string);
if (iter == registeredStrings.end()) {
+ quint32 len = string.length();
+ QByteArray lendata((const char *)&len, sizeof(quint32));
QByteArray strdata((const char *)string.constData(), string.length() * sizeof(QChar));
+ strdata.prepend(lendata);
int rv = data.count();
data += strdata;
@@ -2009,10 +2053,9 @@ int QmlBindingCompilerPrivate::registerString(const QString &string)
}
Instr reg;
- reg.type = Instr::InitString;
+ reg.common.type = Instr::InitString;
reg.initstring.offset = iter->first;
reg.initstring.dataIdx = iter->second;
- reg.initstring.length = string.length();
bytecode << reg;
return reg.initstring.offset;
}
@@ -2138,7 +2181,7 @@ QByteArray QmlBindingCompiler::program() const
QVector<Instr> bytecode;
Instr skip;
- skip.type = Instr::Skip;
+ skip.common.type = Instr::Skip;
skip.skip.reg = -1;
for (int ii = 0; ii < d->committed.count(); ++ii) {
skip.skip.count = d->committed.count() - ii - 1;
diff --git a/src/declarative/qml/qmlbindingvme_p.h b/src/declarative/qml/qmlbindingvme_p.h
index ceaf2b3..4ef7d04 100644
--- a/src/declarative/qml/qmlbindingvme_p.h
+++ b/src/declarative/qml/qmlbindingvme_p.h
@@ -56,6 +56,7 @@
#include <QtCore/qglobal.h>
#include <private/qmlbasicscript_p.h>
#include <private/qscriptdeclarativeclass_p.h>
+#include "qmlguard_p.h"
QT_BEGIN_HEADER
@@ -73,7 +74,7 @@ public:
int targetSlot;
struct Subscription {
- QGuard<QObject> source;
+ QmlGuard<QObject> source;
int notifyIndex;
};
Subscription *subscriptions;
diff --git a/src/declarative/qml/qmlcontext_p.h b/src/declarative/qml/qmlcontext_p.h
index 25f5600..bc8c357 100644
--- a/src/declarative/qml/qmlcontext_p.h
+++ b/src/declarative/qml/qmlcontext_p.h
@@ -65,7 +65,7 @@
#include <QtCore/qset.h>
#include <private/qobject_p.h>
-#include <private/qguard_p.h>
+#include "qmlguard_p.h"
QT_BEGIN_NAMESPACE
@@ -112,13 +112,13 @@ public:
QmlDeclarativeData *contextObjects;
- struct ContextGuard : public QGuard<QObject>
+ struct ContextGuard : public QmlGuard<QObject>
{
ContextGuard() : priv(0), bindings(0) {}
QmlContextPrivate *priv;
QmlBinding_Id *bindings;
ContextGuard &operator=(QObject *obj) {
- (QGuard<QObject>&)*this = obj; return *this;
+ (QmlGuard<QObject>&)*this = obj; return *this;
}
void objectDestroyed(QObject *) { priv->destroyed(this); }
};
diff --git a/src/declarative/qml/qmlcontextscriptclass.cpp b/src/declarative/qml/qmlcontextscriptclass.cpp
index 54a5ca3..588a397 100644
--- a/src/declarative/qml/qmlcontextscriptclass.cpp
+++ b/src/declarative/qml/qmlcontextscriptclass.cpp
@@ -44,14 +44,15 @@
#include "qmlengine_p.h"
#include "qmlcontext_p.h"
#include "qmltypenamescriptclass_p.h"
+#include "qmlguard_p.h"
QT_BEGIN_NAMESPACE
struct ContextData : public QScriptDeclarativeClass::Object {
ContextData() : isSharedContext(true) {}
ContextData(QmlContext *c, QObject *o) : context(c), scopeObject(o), isSharedContext(false) {}
- QGuard<QmlContext> context;
- QGuard<QObject> scopeObject;
+ QmlGuard<QmlContext> context;
+ QmlGuard<QObject> scopeObject;
bool isSharedContext;
QmlContext *getContext(QmlEngine *engine) {
diff --git a/src/declarative/qml/qmldeclarativedata_p.h b/src/declarative/qml/qmldeclarativedata_p.h
index bdbb5c8..21111dd 100644
--- a/src/declarative/qml/qmldeclarativedata_p.h
+++ b/src/declarative/qml/qmldeclarativedata_p.h
@@ -54,8 +54,8 @@
//
#include <QtScript/qscriptvalue.h>
-
#include <private/qobject_p.h>
+#include "qmlguard_p.h"
QT_BEGIN_NAMESPACE
@@ -66,7 +66,11 @@ class QmlPropertyCache;
class QmlDeclarativeData : public QDeclarativeData
{
public:
- QmlDeclarativeData(QmlContext *context = 0);
+ QmlDeclarativeData(QmlContext *ctxt = 0)
+ : context(ctxt), bindings(0), nextContextObject(0), prevContextObject(0),
+ bindingBitsSize(0), bindingBits(0), outerContext(0), lineNumber(0),
+ columnNumber(0), deferredComponent(0), deferredIdx(0), attachedProperties(0),
+ propertyCache(0), guards(0) {}
virtual void destroyed(QObject *);
@@ -95,12 +99,13 @@ public:
QScriptValue scriptValue;
QmlPropertyCache *propertyCache;
+ QmlGuard<QObject> *guards;
+
static QmlDeclarativeData *get(const QObject *object, bool create = false) {
- QObjectPrivate *priv =
- QObjectPrivate::get(const_cast<QObject *>(object));
- if (priv && priv->declarativeData) {
+ QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
+ if (priv->declarativeData) {
return static_cast<QmlDeclarativeData *>(priv->declarativeData);
- } else if (create && priv) {
+ } else if (create) {
priv->declarativeData = new QmlDeclarativeData;
return static_cast<QmlDeclarativeData *>(priv->declarativeData);
} else {
@@ -109,6 +114,25 @@ public:
}
};
+template<class T>
+void QmlGuard<T>::addGuard()
+{
+ QmlDeclarativeData *data = QmlDeclarativeData::get(o, true);
+ next = data->guards;
+ if (next) reinterpret_cast<QmlGuard<T> *>(next)->prev = &next;
+ data->guards = reinterpret_cast<QmlGuard<QObject> *>(this);
+ prev = &data->guards;
+}
+
+template<class T>
+void QmlGuard<T>::remGuard()
+{
+ if (next) reinterpret_cast<QmlGuard<T> *>(next)->prev = prev;
+ *prev = next;
+ next = 0;
+ prev = 0;
+}
+
QT_END_NAMESPACE
#endif // QMLDECLARATIVEDATA_P_H
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 988962b..0e9b7c4 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -549,15 +549,7 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool cre
return rv;
}
-QmlDeclarativeData::QmlDeclarativeData(QmlContext *ctxt)
-: context(ctxt), bindings(0), nextContextObject(0), prevContextObject(0),
- bindingBitsSize(0), bindingBits(0), outerContext(0), lineNumber(0),
- columnNumber(0), deferredComponent(0), deferredIdx(0), attachedProperties(0),
- propertyCache(0)
-{
-}
-
-void QmlDeclarativeData::destroyed(QObject * /*object*/)
+void QmlDeclarativeData::destroyed(QObject *object)
{
if (deferredComponent)
deferredComponent->release();
@@ -584,6 +576,16 @@ void QmlDeclarativeData::destroyed(QObject * /*object*/)
if (propertyCache)
propertyCache->release();
+ QmlGuard<QObject> *guard = guards;
+ while (guard) {
+ QmlGuard<QObject> *g = guard;
+ guard = guard->next;
+ g->o = 0;
+ g->prev = 0;
+ g->next = 0;
+ g->objectDestroyed(object);
+ }
+
delete this;
}
diff --git a/src/declarative/qml/qmlexpression_p.h b/src/declarative/qml/qmlexpression_p.h
index 57a3ce2..3f87b2f 100644
--- a/src/declarative/qml/qmlexpression_p.h
+++ b/src/declarative/qml/qmlexpression_p.h
@@ -57,11 +57,10 @@
#include "qmlbasicscript_p.h"
#include "qmlengine_p.h"
+#include "qmlguard_p.h"
#include <QtScript/qscriptvalue.h>
-#include <private/qguard_p.h>
-
QT_BEGIN_NAMESPACE
class QmlAbstractExpression
@@ -109,15 +108,15 @@ public:
QString url; // This is a QString for a reason. QUrls are slooooooow...
int line;
- struct SignalGuard : public QGuard<QObject> {
+ struct SignalGuard : public QmlGuard<QObject> {
SignalGuard() : isDuplicate(false), notifyIndex(-1) {}
SignalGuard &operator=(QObject *obj) {
- QGuard<QObject>::operator=(obj);
+ QmlGuard<QObject>::operator=(obj);
return *this;
}
SignalGuard &operator=(const SignalGuard &o) {
- QGuard<QObject>::operator=(o);
+ QmlGuard<QObject>::operator=(o);
isDuplicate = o.isDuplicate;
notifyIndex = o.notifyIndex;
return *this;
diff --git a/src/declarative/qml/qmlguard_p.h b/src/declarative/qml/qmlguard_p.h
new file mode 100644
index 0000000..42a4406
--- /dev/null
+++ b/src/declarative/qml/qmlguard_p.h
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMLGUARD_P_H
+#define QMLGUARD_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class QObject;
+template<class T>
+class QmlGuard
+{
+ QObject *o;
+ QmlGuard<QObject> *next;
+ QmlGuard<QObject> **prev;
+ friend class QmlDeclarativeData;
+public:
+ inline QmlGuard();
+ inline QmlGuard(T *);
+ inline QmlGuard(const QmlGuard<T> &);
+ inline virtual ~QmlGuard();
+
+ inline QmlGuard<T> &operator=(const QmlGuard<T> &o);
+ inline QmlGuard<T> &operator=(T *);
+
+ inline bool isNull() const
+ { return !o; }
+
+ inline T* operator->() const
+ { return static_cast<T*>(const_cast<QObject*>(o)); }
+ inline T& operator*() const
+ { return *static_cast<T*>(const_cast<QObject*>(o)); }
+ inline operator T*() const
+ { return static_cast<T*>(const_cast<QObject*>(o)); }
+ inline T* data() const
+ { return static_cast<T*>(const_cast<QObject*>(o)); }
+
+protected:
+ virtual void objectDestroyed(T *) {}
+
+private:
+ inline void addGuard();
+ inline void remGuard();
+};
+
+QT_END_NAMESPACE
+
+#include "qmldeclarativedata_p.h"
+
+QT_BEGIN_NAMESPACE
+
+template<class T>
+QmlGuard<T>::QmlGuard()
+: o(0), next(0), prev(0)
+{
+}
+
+template<class T>
+QmlGuard<T>::QmlGuard(T *g)
+: o(g), next(0), prev(0)
+{
+ if (o) addGuard();
+}
+
+template<class T>
+QmlGuard<T>::QmlGuard(const QmlGuard<T> &g)
+: o(g.o), next(0), prev(0)
+{
+ if (o) addGuard();
+}
+
+template<class T>
+QmlGuard<T>::~QmlGuard()
+{
+ if (prev) remGuard();
+ o = 0;
+}
+
+template<class T>
+QmlGuard<T> &QmlGuard<T>::operator=(const QmlGuard<T> &g)
+{
+ if (g.o != o) {
+ if (prev) remGuard();
+ o = g.o;
+ if (o) addGuard();
+ }
+ return *this;
+}
+
+template<class T>
+QmlGuard<T> &QmlGuard<T>::operator=(T *g)
+{
+ if (g != o) {
+ if (prev) remGuard();
+ o = g;
+ if (o) addGuard();
+ }
+ return *this;
+}
+
+QT_END_NAMESPACE
+
+#endif // QMLGUARD_P_H
diff --git a/src/declarative/qml/qmllistscriptclass.cpp b/src/declarative/qml/qmllistscriptclass.cpp
index d93498d..f5ff2c0 100644
--- a/src/declarative/qml/qmllistscriptclass.cpp
+++ b/src/declarative/qml/qmllistscriptclass.cpp
@@ -42,11 +42,12 @@
#include "qmllistscriptclass_p.h"
#include "qmlengine_p.h"
+#include "qmlguard_p.h"
QT_BEGIN_NAMESPACE
struct ListData : public QScriptDeclarativeClass::Object {
- QGuard<QObject> object;
+ QmlGuard<QObject> object;
int propertyIdx;
QmlListScriptClass::ListType type;
};
diff --git a/src/declarative/qml/qmlmetaproperty_p.h b/src/declarative/qml/qmlmetaproperty_p.h
index b4d72bb..97b5208 100644
--- a/src/declarative/qml/qmlmetaproperty_p.h
+++ b/src/declarative/qml/qmlmetaproperty_p.h
@@ -56,6 +56,7 @@
#include "qmlmetaproperty.h"
#include "qmlpropertycache_p.h"
+#include "qmlguard_p.h"
#include <private/qobject_p.h>
@@ -77,7 +78,7 @@ public:
QmlMetaProperty *q;
QmlContext *context;
- QGuard<QObject> object;
+ QmlGuard<QObject> object;
bool isDefaultProperty:1;
bool isNameCached:1;
diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp
index 4488ba1..7f95b8f 100644
--- a/src/declarative/qml/qmlobjectscriptclass.cpp
+++ b/src/declarative/qml/qmlobjectscriptclass.cpp
@@ -47,16 +47,15 @@
#include "qmltypenamescriptclass_p.h"
#include "qmllistscriptclass_p.h"
#include "qmlbinding.h"
+#include "qmlguard_p.h"
#include <QtCore/qtimer.h>
-#include <private/qguard_p.h>
-
QT_BEGIN_NAMESPACE
struct ObjectData : public QScriptDeclarativeClass::Object {
ObjectData(QObject *o, int t) : object(o), type(t) {}
- QGuard<QObject> object;
+ QmlGuard<QObject> object;
int type;
};
diff --git a/src/declarative/qml/qmlvaluetypescriptclass.cpp b/src/declarative/qml/qmlvaluetypescriptclass.cpp
index 57f999f..78580e3 100644
--- a/src/declarative/qml/qmlvaluetypescriptclass.cpp
+++ b/src/declarative/qml/qmlvaluetypescriptclass.cpp
@@ -42,12 +42,13 @@
#include "qmlvaluetypescriptclass_p.h"
#include "qmlengine_p.h"
+#include "qmlguard_p.h"
QT_BEGIN_NAMESPACE
struct QmlValueTypeReference : public QScriptDeclarativeClass::Object {
QmlValueType *type;
- QGuard<QObject> object;
+ QmlGuard<QObject> object;
int property;
};
diff --git a/src/declarative/qml/qmlvmemetaobject_p.h b/src/declarative/qml/qmlvmemetaobject_p.h
index e737721..462f652 100644
--- a/src/declarative/qml/qmlvmemetaobject_p.h
+++ b/src/declarative/qml/qmlvmemetaobject_p.h
@@ -61,6 +61,8 @@
#include <private/qobject_p.h>
+#include "qmlguard_p.h"
+
QT_BEGIN_NAMESPACE
#define QML_ALIAS_FLAG_PTR 0x00000001
@@ -118,7 +120,7 @@ protected:
private:
QObject *object;
QmlRefCount *ref;
- QGuard<QmlContext> ctxt;
+ QmlGuard<QmlContext> ctxt;
const QmlVMEMetaData *metaData;
int propOffset;
diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp
index 48e026e..18f32ff 100644
--- a/src/declarative/util/qmlpropertychanges.cpp
+++ b/src/declarative/util/qmlpropertychanges.cpp
@@ -49,6 +49,7 @@
#include <qmlexpression.h>
#include <qmlbinding.h>
#include <qmlcontext.h>
+#include <qmlguard_p.h>
#include <QtCore/qdebug.h>
@@ -127,7 +128,7 @@ public:
QmlExpression *expression;
QmlExpression *reverseExpression;
QmlExpression *rewindExpression;
- QGuard<QmlExpression> ownedExpression;
+ QmlGuard<QmlExpression> ownedExpression;
virtual void execute() {
ownedExpression = property.setSignalExpression(expression);
diff --git a/src/declarative/util/qmlstate_p_p.h b/src/declarative/util/qmlstate_p_p.h
index 04c5264..0ae72cd 100644
--- a/src/declarative/util/qmlstate_p_p.h
+++ b/src/declarative/util/qmlstate_p_p.h
@@ -58,6 +58,8 @@
#include "qmlanimation_p_p.h"
#include "qmltransitionmanager_p_p.h"
+#include <qmlguard_p.h>
+
#include <private/qobject_p.h>
QT_BEGIN_NAMESPACE
@@ -106,9 +108,9 @@ public:
QmlBinding *when;
class OperationList;
- struct OperationGuard : public QGuard<QmlStateOperation>
+ struct OperationGuard : public QmlGuard<QmlStateOperation>
{
- OperationGuard(QObject *obj, OperationList *l) : list(l) { (QGuard<QObject>&)*this = obj; }
+ OperationGuard(QObject *obj, OperationList *l) : list(l) { (QmlGuard<QObject>&)*this = obj; }
OperationList *list;
void objectDestroyed(QmlStateOperation *) {
// we assume priv will always be destroyed after objectDestroyed calls
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index ebbb5ee..df25e5b 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -47,6 +47,7 @@
#include <qmlinfo.h>
#include <qmlgraphicsanchors_p_p.h>
#include <qmlgraphicsitem_p.h>
+#include <qmlguard_p.h>
#include <QtCore/qdebug.h>
#include <QtGui/qgraphicsitem.h>
@@ -65,8 +66,8 @@ public:
QmlGraphicsItem *target;
QmlGraphicsItem *parent;
- QGuard<QmlGraphicsItem> origParent;
- QGuard<QmlGraphicsItem> origStackBefore;
+ QmlGuard<QmlGraphicsItem> origParent;
+ QmlGuard<QmlGraphicsItem> origStackBefore;
QmlGraphicsItem *rewindParent;
QmlGraphicsItem *rewindStackBefore;
diff --git a/tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml b/tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml
new file mode 100644
index 0000000..31c879b
--- /dev/null
+++ b/tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml
@@ -0,0 +1,34 @@
+import Qt 4.6
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ Item {
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.leftMargin: 0
+ }
+ }
+ }
+ }
+}
+
diff --git a/tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml b/tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml
new file mode 100644
index 0000000..23fe78e
--- /dev/null
+++ b/tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml
@@ -0,0 +1,41 @@
+import Qt 4.6
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ Item {
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ }
+ }
+ }
+ }
+}
+
diff --git a/tests/benchmarks/declarative/qmltime/tests/anchors/null.qml b/tests/benchmarks/declarative/qmltime/tests/anchors/null.qml
new file mode 100644
index 0000000..bc447ef
--- /dev/null
+++ b/tests/benchmarks/declarative/qmltime/tests/anchors/null.qml
@@ -0,0 +1,27 @@
+import Qt 4.6
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ Item {
+ }
+ Item {
+ }
+ Item {
+ }
+ Item {
+ }
+ Item {
+ }
+ Item {
+ }
+ Item {
+ }
+ }
+ }
+ }
+}
+