summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-03-25 10:50:03 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-03-31 14:32:43 (GMT)
commitd7ee1cc6456e35823d2c470feec6219ef516e1f6 (patch)
tree62f90e3323c87a5a7e22c1b63558f249fdbaba5f /src/corelib/kernel
parentdfcc156a75f32f1147e95ce06e4262c102ee858e (diff)
downloadQt-d7ee1cc6456e35823d2c470feec6219ef516e1f6.zip
Qt-d7ee1cc6456e35823d2c470feec6219ef516e1f6.tar.gz
Qt-d7ee1cc6456e35823d2c470feec6219ef516e1f6.tar.bz2
Improve slightly the performence of activate
Avoid the overhead of QObjectConnectionListVector::at(), when we know anyway which list to take. Reviewed-by: brad
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qobject.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 7ad9f9b..c6f2456 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -263,12 +263,6 @@ public:
: QVector<QObjectPrivate::ConnectionList>(), orphaned(false), dirty(false), inUse(0)
{ }
- const QObjectPrivate::ConnectionList &at(int at) const
- {
- if (at < 0)
- return allsignals;
- return QVector<QObjectPrivate::ConnectionList>::at(at);
- }
QObjectPrivate::ConnectionList &operator[](int at)
{
if (at < 0)
@@ -3489,16 +3483,20 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
return;
}
++connectionLists->inUse;
- if (signal_index >= connectionLists->count()) {
- signal_index = -2; //for "all signals";
- }
+
+
+ const QObjectPrivate::ConnectionList *list;
+ if (signal_index < connectionLists->count())
+ list = &connectionLists->at(signal_index);
+ else
+ list = &connectionLists->allsignals;
do {
- QObjectPrivate::Connection *c = connectionLists->at(signal_index).first;
+ QObjectPrivate::Connection *c = list->first;
if (!c) continue;
// We need to check against last here to ensure that signals added
// during the signal emission are not emitted in this emission.
- QObjectPrivate::Connection *last = connectionLists->at(signal_index).last;
+ QObjectPrivate::Connection *last = list->last;
do {
if (!c->receiver)
@@ -3582,7 +3580,9 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
if (connectionLists->orphaned)
break;
- } while (signal_index >= 0 && (signal_index = -1)); //start over for -1 (all signal)
+ } while (list != &connectionLists->allsignals &&
+ //start over for all signals;
+ ((list = &connectionLists->allsignals), true));
--connectionLists->inUse;
Q_ASSERT(connectionLists->inUse >= 0);