summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusconnection_p.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-12-31 21:50:13 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-01-02 02:18:23 (GMT)
commit988decb610ec5e12380c60204878a0b9e2aaeb01 (patch)
tree65488227a51b82f1f72739bb0629a724b5d5a891 /src/dbus/qdbusconnection_p.h
parent75a1c11478ee28547c7b21b54cd64be0585fed95 (diff)
downloadQt-988decb610ec5e12380c60204878a0b9e2aaeb01.zip
Qt-988decb610ec5e12380c60204878a0b9e2aaeb01.tar.gz
Qt-988decb610ec5e12380c60204878a0b9e2aaeb01.tar.bz2
Change the QtDBus watched service list to a map to its owner.
Instead of simply counting how many times we're watching a service, also map a service to its owner. This allows us to provide a faster, cached GetNameOwner too. Technically, this could mean that a service that is started in-between event loops could remain invalid for a longer period of time. I'm not sure this is an issue -- will need some testing in KDE. Task-number: QTBUG-5979 Reviewed-By: TrustMe
Diffstat (limited to 'src/dbus/qdbusconnection_p.h')
-rw-r--r--src/dbus/qdbusconnection_p.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index d6f7598..5cffdce 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -155,7 +155,13 @@ public:
typedef QMultiHash<QString, SignalHook> SignalHookHash;
typedef QHash<QString, QDBusMetaObject* > MetaObjectHash;
typedef QHash<QByteArray, int> MatchRefCountHash;
- typedef QHash<QString, int> WatchedServicesHash;
+
+ struct WatchedServiceData {
+ WatchedServiceData() : refcount(0) {}
+ QString owner;
+ int refcount;
+ };
+ typedef QHash<QString, WatchedServiceData> WatchedServicesHash;
public:
// public methods are entry points from other objects
@@ -223,6 +229,8 @@ private:
bool isServiceRegisteredByThread(const QString &serviceName) const;
+ QString getNameOwnerNoCache(const QString &service);
+
protected:
void customEvent(QEvent *e);
void timerEvent(QTimerEvent *e);
@@ -271,7 +279,7 @@ public:
QDBusError lastError;
QStringList serviceNames;
- WatchedServicesHash watchedServiceNames;
+ WatchedServicesHash watchedServices;
SignalHookHash signalHooks;
MatchRefCountHash matchRefCounts;
ObjectTreeNode rootNode;