From 246bf336eced99b7bafa0a88a06d532c3cb9b8eb Mon Sep 17 00:00:00 2001 From: Ben Tian Date: Tue, 28 Apr 2015 11:12:13 +0800 Subject: [PATCH] Bug 1158081 - Patch (1/2): Define macro to declare SocketObserver functions, r=tzimmermann --- dom/bluetooth/BluetoothSocketObserver.h | 9 ++++++++- dom/bluetooth/bluedroid/BluetoothOppManager.h | 9 +-------- dom/bluetooth/bluez/BluetoothHfpManager.h | 11 ++--------- dom/bluetooth/bluez/BluetoothOppManager.h | 9 +-------- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/dom/bluetooth/BluetoothSocketObserver.h b/dom/bluetooth/BluetoothSocketObserver.h index 8b68ccc7aa4f..b4ca47a236c2 100644 --- a/dom/bluetooth/BluetoothSocketObserver.h +++ b/dom/bluetooth/BluetoothSocketObserver.h @@ -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& aMessage) override; \ + virtual void OnSocketConnectSuccess(BluetoothSocket* aSocket) override; \ + virtual void OnSocketConnectError(BluetoothSocket* aSocket) override; \ + virtual void OnSocketDisconnect(BluetoothSocket* aSocket) override; + END_BLUETOOTH_NAMESPACE #endif diff --git a/dom/bluetooth/bluedroid/BluetoothOppManager.h b/dom/bluetooth/bluedroid/BluetoothOppManager.h index e49ef3c37eb5..e193dabcca25 100644 --- a/dom/bluetooth/bluedroid/BluetoothOppManager.h +++ b/dom/bluetooth/bluedroid/BluetoothOppManager.h @@ -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& aMessage) override; - virtual void OnSocketConnectSuccess(BluetoothSocket* aSocket) override; - virtual void OnSocketConnectError(BluetoothSocket* aSocket) override; - virtual void OnSocketDisconnect(BluetoothSocket* aSocket) override; - protected: virtual ~BluetoothOppManager(); diff --git a/dom/bluetooth/bluez/BluetoothHfpManager.h b/dom/bluetooth/bluez/BluetoothHfpManager.h index 9fb5fd548d22..5078f5ea50e2 100644 --- a/dom/bluetooth/bluez/BluetoothHfpManager.h +++ b/dom/bluetooth/bluez/BluetoothHfpManager.h @@ -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& 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 diff --git a/dom/bluetooth/bluez/BluetoothOppManager.h b/dom/bluetooth/bluez/BluetoothOppManager.h index e713f71d7848..4c22cc9f8643 100644 --- a/dom/bluetooth/bluez/BluetoothOppManager.h +++ b/dom/bluetooth/bluez/BluetoothOppManager.h @@ -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& aMessage) override; - virtual void OnSocketConnectSuccess(BluetoothSocket* aSocket) override; - virtual void OnSocketConnectError(BluetoothSocket* aSocket) override; - virtual void OnSocketDisconnect(BluetoothSocket* aSocket) override; - protected: virtual ~BluetoothOppManager();