src/dbus/qdbusconnection_p.h
changeset 18 2f34d5167611
parent 3 41300fa6a67c
child 30 5dc02b23752f
--- a/src/dbus/qdbusconnection_p.h	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/dbus/qdbusconnection_p.h	Fri Apr 16 15:50:13 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -119,7 +119,7 @@
     struct SignalHook
     {
         inline SignalHook() : obj(0), midx(-1) { }
-        QString owner, service, path, signature;
+        QString service, path, signature;
         QObject* obj;
         int midx;
         QList<int> params;
@@ -155,7 +155,13 @@
     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
@@ -177,7 +183,7 @@
     QDBusPendingCallPrivate *sendWithReplyAsync(const QDBusMessage &message, int timeout = -1);
     int sendWithReplyAsync(const QDBusMessage &message, QObject *receiver,
                            const char *returnMethod, const char *errorMethod, int timeout = -1);
-    bool connectSignal(const QString &service, const QString &owner, const QString &path, const QString& interface,
+    bool connectSignal(const QString &service, const QString &path, const QString& interface,
                        const QString &name, const QStringList &argumentMatch, const QString &signature,
                        QObject *receiver, const char *slot);
     void connectSignal(const QString &key, const SignalHook &hook);
@@ -186,10 +192,10 @@
                           const QString &name, const QStringList &argumentMatch, const QString &signature,
                           QObject *receiver, const char *slot);
     void registerObject(const ObjectTreeNode *node);
-    void connectRelay(const QString &service, const QString &currentOwner,
+    void connectRelay(const QString &service,
                       const QString &path, const QString &interface,
                       QDBusAbstractInterface *receiver, const char *signal);
-    void disconnectRelay(const QString &service, const QString &currentOwner,
+    void disconnectRelay(const QString &service,
                          const QString &path, const QString &interface,
                          QDBusAbstractInterface *receiver, const char *signal);
 
@@ -223,6 +229,8 @@
 
     bool isServiceRegisteredByThread(const QString &serviceName) const;
 
+    QString getNameOwnerNoCache(const QString &service);
+
 protected:
     void customEvent(QEvent *e);
     void timerEvent(QTimerEvent *e);
@@ -271,7 +279,7 @@
     QDBusError lastError;
 
     QStringList serviceNames;
-    WatchedServicesHash watchedServiceNames;
+    WatchedServicesHash watchedServices;
     SignalHookHash signalHooks;
     MatchRefCountHash matchRefCounts;
     ObjectTreeNode rootNode;
@@ -284,7 +292,7 @@
     // static methods
     static int findSlot(QObject *obj, const QByteArray &normalizedName, QList<int>& params);
     static bool prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key,
-                            const QString &service, const QString &owner,
+                            const QString &service,
                             const QString &path, const QString &interface, const QString &name,
                             const QStringList &argMatch,
                             QObject *receiver, const char *signal, int minMIdx,