aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlabstractbinding_p.h
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2012-05-23 11:38:46 +0100
committerQt by Nokia <qt-info@nokia.com>2012-05-24 17:50:07 +0200
commit6ff8aa4b83e801acadd45cc32759ea77cf4532c8 (patch)
tree564c6585f8ce46321709069708be7d77f17c3779 /src/qml/qml/qqmlabstractbinding_p.h
parent72ac68162e4ab94bb2b62e047a726c119f77df13 (diff)
Reduce size of QQmlAbstractBinding
The doubly-linked list is unnecessary. Most bindings are created at startup, and removed only when the object is destroyed. In these cases the double-link buys nothing other than wasted space. Even when the bindings are removed earlier, searching the list is not that slow. Change-Id: I22e1376b78ba712dafd171c7447fbc6ed212b891 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlabstractbinding_p.h')
-rw-r--r--src/qml/qml/qqmlabstractbinding_p.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlabstractbinding_p.h b/src/qml/qml/qqmlabstractbinding_p.h
index ed414964f8..f3071cf8bf 100644
--- a/src/qml/qml/qqmlabstractbinding_p.h
+++ b/src/qml/qml/qqmlabstractbinding_p.h
@@ -65,8 +65,6 @@ class Q_QML_PRIVATE_EXPORT QQmlAbstractBinding
public:
typedef QWeakPointer<QQmlAbstractBinding> Pointer;
- QQmlAbstractBinding();
-
virtual void destroy();
virtual QString expression() const;
@@ -95,6 +93,7 @@ public:
static void printBindingLoopError(QQmlProperty &prop);
protected:
+ QQmlAbstractBinding();
virtual ~QQmlAbstractBinding();
void clear();
@@ -114,9 +113,13 @@ private:
typedef QSharedPointer<QQmlAbstractBinding> SharedPointer;
// To save memory, we also store the rarely used weakPointer() instance in here
+ // We also use the flag bits:
+ // m_mePtr.flag1: added to object
QPointerValuePair<QQmlAbstractBinding*, SharedPointer> m_mePtr;
- QQmlAbstractBinding **m_prevBinding;
+ inline void setAddedToObject(bool v);
+ inline bool isAddedToObject() const;
+
QQmlAbstractBinding *m_nextBinding;
};
@@ -126,6 +129,16 @@ QQmlAbstractBinding::getPointer(QQmlAbstractBinding *p)
return p ? p->weakPointer() : Pointer();
}
+void QQmlAbstractBinding::setAddedToObject(bool v)
+{
+ m_mePtr.setFlagValue(v);
+}
+
+bool QQmlAbstractBinding::isAddedToObject() const
+{
+ return m_mePtr.flag();
+}
+
QT_END_NAMESPACE
#endif // QQMLABSTRACTBINDING_P_H