summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-03-30 16:03:24 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-04-20 13:48:57 (GMT)
commit7f207df8cc63762e32803505aaf6e9b320fd6ba5 (patch)
tree04439b5b15d00a73a46fda551af131d4d3c9b934 /src/corelib/kernel/qobject.cpp
parentc90b3ec191430e8b6bf5526124919df0bd0cf518 (diff)
downloadQt-7f207df8cc63762e32803505aaf6e9b320fd6ba5.zip
Qt-7f207df8cc63762e32803505aaf6e9b320fd6ba5.tar.gz
Qt-7f207df8cc63762e32803505aaf6e9b320fd6ba5.tar.bz2
Optimize QMetaObject::activate
Mainly by inlining what should be inlined Reviewed-by: Thiago
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r--src/corelib/kernel/qobject.cpp27
1 files changed, 3 insertions, 24 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index c13d829..3a37cb1 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -101,7 +101,7 @@ static QBasicAtomicInt objectCount = Q_BASIC_ATOMIC_INITIALIZER(0);
/** \internal
* mutex to be locked when accessing the connectionlists or the senders list
*/
-static QMutex *signalSlotLock(const QObject *o)
+static inline QMutex *signalSlotLock(const QObject *o)
{
if (!signalSlotMutexes) {
QMutexPool *mp = new QMutexPool;
@@ -393,27 +393,6 @@ void QObjectPrivate::cleanConnectionLists()
}
}
-QObjectPrivate::Sender *QObjectPrivate::setCurrentSender(QObject *receiver,
- Sender *sender)
-{
- Sender *previousSender = receiver->d_func()->currentSender;
- receiver->d_func()->currentSender = sender;
- return previousSender;
-}
-
-void QObjectPrivate::resetCurrentSender(QObject *receiver,
- Sender *currentSender,
- Sender *previousSender)
-{
- // ref is set to zero when this object is deleted during the metacall
- if (currentSender->ref == 1)
- receiver->d_func()->currentSender = previousSender;
- // if we've recursed, we need to tell the caller about the objects deletion
- if (previousSender)
- previousSender->ref = currentSender->ref;
-}
-
-
typedef QMultiHash<QObject *, QObject **> GuardHash;
Q_GLOBAL_STATIC(GuardHash, guardHash)
Q_GLOBAL_STATIC(QMutex, guardHashLock)
@@ -3231,9 +3210,9 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
argv ? argv : empty_argv);
}
- QMutexLocker locker(signalSlotLock(sender));
QThreadData *currentThreadData = QThreadData::current();
+ QMutexLocker locker(signalSlotLock(sender));
QObjectConnectionListVector *connectionLists = sender->d_func()->connectionLists;
if (!connectionLists) {
locker.unlock();
@@ -3329,7 +3308,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
if (connectionLists->orphaned) {
if (!connectionLists->inUse)
delete connectionLists;
- } else {
+ } else if (connectionLists->dirty) {
sender->d_func()->cleanConnectionLists();
}