aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlboundsignal_p.h
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2012-04-23 17:25:48 +1000
committerQt by Nokia <qt-info@nokia.com>2012-04-26 02:12:36 +0200
commit669ba098e44080991e0d17827622ecb8928650df (patch)
treeb246b4a2181e66ccfd7057149a5e899753d25094 /src/qml/qml/qqmlboundsignal_p.h
parent8a69992c34bf456df54a5ba26955e782acd4531c (diff)
Optimise memory usage of bound signals
We can save a few bytes per bound signal by using a flag pointer. Change-Id: I96d23dc287722e549e21e4c5d978bed0ba2f4bed Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlboundsignal_p.h')
-rw-r--r--src/qml/qml/qqmlboundsignal_p.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlboundsignal_p.h b/src/qml/qml/qqmlboundsignal_p.h
index e4115886ba..7ce45aa646 100644
--- a/src/qml/qml/qqmlboundsignal_p.h
+++ b/src/qml/qml/qqmlboundsignal_p.h
@@ -58,6 +58,7 @@
#include <private/qqmlabstractexpression_p.h>
#include <private/qqmljavascriptexpression_p.h>
#include <private/qqmlnotifier_p.h>
+#include <private/qflagpointer_p.h>
#include <private/qobject_p.h>
QT_BEGIN_NAMESPACE
@@ -134,19 +135,24 @@ public:
QQmlBoundSignalExpression *expression() const;
QQmlBoundSignalExpression *setExpression(QQmlBoundSignalExpression *);
- QObject *scope() { return m_scope; }
+ QObject *scope() { return *m_scope; }
static void subscriptionCallback(QQmlNotifierEndpoint *e, void **);
- bool isEvaluating() const { return m_isEvaluating; }
+ bool isEvaluating() const { return m_scope.flag(); }
private:
QQmlBoundSignalExpression *m_expression;
QQmlBoundSignalParameters *m_params;
- QObject *m_scope;
+ // We store some flag bits in the following flag pointer.
+ // m_scope:flag1 - m_isEvaluating
+ // m_scope:flag2 - m_paramsValid
+ QFlagPointer<QObject> m_scope;
int m_index;
- bool m_paramsValid : 1;
- bool m_isEvaluating : 1;
+
+ void setIsEvaluating(bool v) { m_scope.setFlagValue(v); }
+ void setParamsValid(bool v) { m_scope.setFlag2Value(v); }
+ bool paramsValid() const { return m_scope.flag2(); }
};