X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fsignalproxy.h;h=bf3742dbc630d733fba211cdd87be825577ddc92;hp=4e59e809c010db7cff4a611b24ae427a43b9c67a;hb=a86c3a08e57e0a23b3e57d0b9ee9d27cc5113d21;hpb=924e2c01204da172a071d34485936b379372e497 diff --git a/src/common/signalproxy.h b/src/common/signalproxy.h index 4e59e809..bf3742db 100644 --- a/src/common/signalproxy.h +++ b/src/common/signalproxy.h @@ -5,7 +5,7 @@ * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -29,6 +29,8 @@ #include #include +#include + class SignalRelay; class QMetaObject; @@ -68,26 +70,37 @@ public: void setInitialized(QObject *obj); bool initialized(QObject *obj); void requestInit(QObject *obj); - + void detachObject(QObject *obj); void detachSignals(QObject *sender); void detachSlots(QObject *receiver); - + void stopSync(QObject *obj); + + //! Writes a QVariant to a device. + /** The data item is prefixed with the resulting blocksize, + * so the corresponding function readDataFromDevice() can check if enough data is available + * at the device to reread the item. + */ static void writeDataToDevice(QIODevice *dev, const QVariant &item); + + //! Reads a data item from a device that has been written by writeDataToDevice(). + /** If not enough data bytes are available, the function returns false and the QVariant reference + * remains untouched. + */ static bool readDataFromDevice(QIODevice *dev, quint32 &blockSize, QVariant &item); static QString methodBaseName(const QMetaMethod &method); const QList &argTypes(QObject *obj, int methodId); const QByteArray &methodName(QObject *obj, int methodId); - const QHash &syncMap(QObject *obj); + const QHash &syncMap(QObject *obj); typedef QHash > ArgHash; typedef QHash MethodNameHash; struct ClassInfo { ArgHash argTypes; MethodNameHash methodNames; - QHash syncMap; + QHash syncMap; }; void dumpProxyStats(); @@ -132,6 +145,12 @@ private: void _detachSignals(QObject *sender); void _detachSlots(QObject *receiver); + void _stopSync(QObject *obj); + + void dumpSyncMap(QObject *object); + + // Hash of used QIODevices + QHash _peerByteCount; // containg a list of argtypes for fast access QHash _classInfo; @@ -148,11 +167,14 @@ private: typedef QHash ObjectId; QHash _syncSlave; - // Hash of used QIODevices - QHash _peerByteCount; ProxyMode _proxyMode; - + + // the slaveMutex protects both containers: + // - _syncSlaves for sync and init calls + // - _attachedSlots + QMutex slaveMutex; + friend class SignalRelay; };