Bug 1158081 - Patch (1/2): Define macro to declare SocketObserver functions, r=tzimmermann

This commit is contained in:
Ben Tian 2015-04-28 11:12:13 +08:00
Родитель a40b086236
Коммит 246bf336ec
4 изменённых файлов: 12 добавлений и 26 удалений

Просмотреть файл

@ -40,9 +40,16 @@ public:
* changes from CONNECTED/LISTENING to DISCONNECTED.
*/
virtual void OnSocketDisconnect(BluetoothSocket* aSocket) = 0;
};
#define BT_DECL_SOCKET_OBSERVER \
public: \
virtual void ReceiveSocketData(BluetoothSocket* aSocket, \
nsAutoPtr<mozilla::ipc::UnixSocketBuffer>& aMessage) override; \
virtual void OnSocketConnectSuccess(BluetoothSocket* aSocket) override; \
virtual void OnSocketConnectError(BluetoothSocket* aSocket) override; \
virtual void OnSocketDisconnect(BluetoothSocket* aSocket) override;
END_BLUETOOTH_NAMESPACE
#endif

Просмотреть файл

@ -40,6 +40,7 @@ class BluetoothOppManager : public BluetoothSocketObserver
public:
BT_DECL_PROFILE_MGR_BASE
BT_DECL_SOCKET_OBSERVER
virtual void GetName(nsACString& aName)
{
aName.AssignLiteral("OPP");
@ -68,14 +69,6 @@ public:
bool ExtractBlobHeaders();
void CheckPutFinal(uint32_t aNumRead);
// The following functions are inherited from BluetoothSocketObserver
void ReceiveSocketData(
BluetoothSocket* aSocket,
nsAutoPtr<mozilla::ipc::UnixSocketBuffer>& aMessage) override;
virtual void OnSocketConnectSuccess(BluetoothSocket* aSocket) override;
virtual void OnSocketConnectError(BluetoothSocket* aSocket) override;
virtual void OnSocketDisconnect(BluetoothSocket* aSocket) override;
protected:
virtual ~BluetoothOppManager();

Просмотреть файл

@ -80,22 +80,15 @@ class BluetoothHfpManager : public BluetoothSocketObserver
{
public:
BT_DECL_HFP_MGR_BASE
BT_DECL_SOCKET_OBSERVER
virtual void GetName(nsACString& aName)
{
aName.AssignLiteral("HFP/HSP");
}
static BluetoothHfpManager* Get();
// The following functions are inherited from BluetoothSocketObserver
virtual void ReceiveSocketData(
BluetoothSocket* aSocket,
nsAutoPtr<mozilla::ipc::UnixSocketBuffer>& aMessage) override;
virtual void OnSocketConnectSuccess(BluetoothSocket* aSocket) override;
virtual void OnSocketConnectError(BluetoothSocket* aSocket) override;
virtual void OnSocketDisconnect(BluetoothSocket* aSocket) override;
bool Listen();
/**
* This function set up a Synchronous Connection (SCO) link for HFP.
* Service Level Connection (SLC) should be established before SCO setup

Просмотреть файл

@ -36,6 +36,7 @@ class BluetoothOppManager : public BluetoothSocketObserver
{
public:
BT_DECL_PROFILE_MGR_BASE
BT_DECL_SOCKET_OBSERVER
virtual void GetName(nsACString& aName)
{
aName.AssignLiteral("OPP");
@ -64,14 +65,6 @@ public:
bool ExtractBlobHeaders();
void CheckPutFinal(uint32_t aNumRead);
// The following functions are inherited from BluetoothSocketObserver
void ReceiveSocketData(
BluetoothSocket* aSocket,
nsAutoPtr<mozilla::ipc::UnixSocketBuffer>& aMessage) override;
virtual void OnSocketConnectSuccess(BluetoothSocket* aSocket) override;
virtual void OnSocketConnectError(BluetoothSocket* aSocket) override;
virtual void OnSocketDisconnect(BluetoothSocket* aSocket) override;
protected:
virtual ~BluetoothOppManager();