aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlnotifier.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2012-05-18 11:11:40 +0100
committerQt by Nokia <qt-info@nokia.com>2012-05-24 17:49:58 +0200
commit72ac68162e4ab94bb2b62e047a726c119f77df13 (patch)
treee8f1bc56ef27347837426b10cb1abb5079cdf9cf /src/qml/qml/qqmlnotifier.cpp
parent59ddedfb6faf040eb052ee25ed7154de1b05eb2c (diff)
Reduce size of QQmlNotifierEndpoint
Change-Id: I4d4a22f5f3d88d4ad2fcd738753fd8da2d8a9263 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlnotifier.cpp')
-rw-r--r--src/qml/qml/qqmlnotifier.cpp46
1 files changed, 33 insertions, 13 deletions
diff --git a/src/qml/qml/qqmlnotifier.cpp b/src/qml/qml/qqmlnotifier.cpp
index 2bae7f64b0..7cbc5e6f72 100644
--- a/src/qml/qml/qqmlnotifier.cpp
+++ b/src/qml/qml/qqmlnotifier.cpp
@@ -46,27 +46,47 @@
QT_BEGIN_NAMESPACE
+typedef void (*Callback)(QQmlNotifierEndpoint *, void **);
+
+void QQmlBoundSignal_callback(QQmlNotifierEndpoint *, void **);
+void QQmlJavaScriptExpressionGuard_callback(QQmlNotifierEndpoint *, void **);
+void QQmlVMEMetaObjectEndpoint_callback(QQmlNotifierEndpoint *, void **);
+void QV4BindingsSubscription_callback(QQmlNotifierEndpoint *, void **);
+
+static Callback QQmlNotifier_callbacks[] = {
+ 0,
+ QQmlBoundSignal_callback,
+ QQmlJavaScriptExpressionGuard_callback,
+ QQmlVMEMetaObjectEndpoint_callback,
+ QV4BindingsSubscription_callback
+};
+
void QQmlNotifier::emitNotify(QQmlNotifierEndpoint *endpoint, void **a)
{
- QQmlNotifierEndpoint **oldDisconnected = endpoint->disconnected;
- endpoint->disconnected = &endpoint;
- endpoint->notifying = 1;
+ intptr_t originalSenderPtr;
+ intptr_t *disconnectWatch;
+
+ if (!endpoint->isNotifying()) {
+ originalSenderPtr = endpoint->senderPtr;
+ disconnectWatch = &originalSenderPtr;
+ endpoint->senderPtr = intptr_t(disconnectWatch) | 0x1;
+ } else {
+ disconnectWatch = (intptr_t *)(endpoint->senderPtr & ~0x1);
+ }
if (endpoint->next)
emitNotify(endpoint->next, a);
- if (endpoint) {
+ if (*disconnectWatch) {
- Q_ASSERT(endpoint->callback);
-
- endpoint->callback(endpoint, a);
+ Q_ASSERT(QQmlNotifier_callbacks[endpoint->callback]);
+ QQmlNotifier_callbacks[endpoint->callback](endpoint, a);
- if (endpoint)
- endpoint->disconnected = oldDisconnected;
+ if (disconnectWatch == &originalSenderPtr && originalSenderPtr) {
+ // End of notifying, restore values
+ endpoint->senderPtr = originalSenderPtr;
+ }
}
-
- if (oldDisconnected) *oldDisconnected = endpoint;
- else if (endpoint) endpoint->notifying = 0;
}
void QQmlNotifierEndpoint::connect(QObject *source, int sourceSignal, QQmlEngine *engine)
@@ -89,7 +109,7 @@ void QQmlNotifierEndpoint::connect(QObject *source, int sourceSignal, QQmlEngine
qPrintable(engineName));
}
- this->source = source;
+ senderPtr = intptr_t(source);
this->sourceSignal = sourceSignal;
QQmlPropertyPrivate::flushSignal(source, sourceSignal);
QQmlData *ddata = QQmlData::get(source, true);