QtDBus: replace some inefficient QLists with QVector
QDBusIntrospection::Argument and the QPair are larger than a void*, so holding them in QLists is needlessly inefficient. Worse, the code could come to depend on the fragile property of (inefficient) QLists that references to elements therein never are invalidated. Fix by marking the types movable, if not already done, and holding them in QVector instead. Change-Id: I1cf88287cc3a1d87e1fcd5061ed8d6d19d2f0722 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
6094ae1ff5
commit
32a5026f36
@ -166,7 +166,7 @@ public:
|
||||
// typedefs
|
||||
typedef QMultiHash<int, Watcher> WatcherHash;
|
||||
typedef QHash<int, DBusTimeout *> TimeoutHash;
|
||||
typedef QList<QPair<DBusTimeout *, int> > PendingTimeoutList;
|
||||
typedef QVector<QPair<DBusTimeout *, int> > PendingTimeoutList;
|
||||
|
||||
typedef QMultiHash<QString, SignalHook> SignalHookHash;
|
||||
typedef QHash<QString, QDBusMetaObject* > MetaObjectHash;
|
||||
|
@ -46,7 +46,7 @@
|
||||
//
|
||||
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qlist.h>
|
||||
#include <QtCore/qvector.h>
|
||||
#include <QtCore/qstringlist.h>
|
||||
#include <QtCore/qmap.h>
|
||||
#include <QtCore/qpair.h>
|
||||
@ -71,7 +71,7 @@ public:
|
||||
|
||||
// typedefs
|
||||
typedef QMap<QString, QString> Annotations;
|
||||
typedef QList<Argument> Arguments;
|
||||
typedef QVector<Argument> Arguments;
|
||||
typedef QMultiMap<QString, Method> Methods;
|
||||
typedef QMultiMap<QString, Signal> Signals;
|
||||
typedef QMap<QString, Property> Properties;
|
||||
@ -158,6 +158,7 @@ public:
|
||||
private:
|
||||
QDBusIntrospection();
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(QDBusIntrospection::Argument, Q_MOVABLE_TYPE);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user