Bug 1137151: Marked destructors of ref-counted Bluetooth classes as protected, r=shuang

This commit is contained in:
Thomas Zimmermann 2015-03-10 13:44:02 +01:00
parent 7da19ec752
commit ad90f39fdf
16 changed files with 74 additions and 34 deletions

View File

@ -23,11 +23,13 @@ public:
} }
static BluetoothHidManager* Get(); static BluetoothHidManager* Get();
virtual ~BluetoothHidManager();
// HID-specific functions // HID-specific functions
void HandleInputPropertyChanged(const BluetoothSignal& aSignal); void HandleInputPropertyChanged(const BluetoothSignal& aSignal);
protected:
virtual ~BluetoothHidManager();
private: private:
BluetoothHidManager(); BluetoothHidManager();
bool Init(); bool Init();

View File

@ -21,8 +21,6 @@ class BluetoothSocketResultHandler
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothSocketResultHandler) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothSocketResultHandler)
virtual ~BluetoothSocketResultHandler() { }
virtual void OnError(BluetoothStatus aStatus) virtual void OnError(BluetoothStatus aStatus)
{ {
BT_WARNING("Received error code %d", (int)aStatus); BT_WARNING("Received error code %d", (int)aStatus);
@ -33,6 +31,9 @@ public:
int aConnectionState) { } int aConnectionState) { }
virtual void Accept(int aSockFd, const nsAString& aBdAddress, virtual void Accept(int aSockFd, const nsAString& aBdAddress,
int aConnectionState) { } int aConnectionState) { }
protected:
virtual ~BluetoothSocketResultHandler() { }
}; };
class BluetoothSocketInterface class BluetoothSocketInterface
@ -67,8 +68,6 @@ protected:
class BluetoothHandsfreeNotificationHandler class BluetoothHandsfreeNotificationHandler
{ {
public: public:
virtual ~BluetoothHandsfreeNotificationHandler();
virtual void virtual void
ConnectionStateNotification(BluetoothHandsfreeConnectionState aState, ConnectionStateNotification(BluetoothHandsfreeConnectionState aState,
const nsAString& aBdAddr) const nsAString& aBdAddr)
@ -151,6 +150,8 @@ public:
protected: protected:
BluetoothHandsfreeNotificationHandler() BluetoothHandsfreeNotificationHandler()
{ } { }
virtual ~BluetoothHandsfreeNotificationHandler();
}; };
class BluetoothHandsfreeResultHandler class BluetoothHandsfreeResultHandler
@ -158,8 +159,6 @@ class BluetoothHandsfreeResultHandler
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothHandsfreeResultHandler) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothHandsfreeResultHandler)
virtual ~BluetoothHandsfreeResultHandler() { }
virtual void OnError(BluetoothStatus aStatus) virtual void OnError(BluetoothStatus aStatus)
{ {
BT_WARNING("Received error code %d", (int)aStatus); BT_WARNING("Received error code %d", (int)aStatus);
@ -188,6 +187,9 @@ public:
virtual void PhoneStateChange() { } virtual void PhoneStateChange() { }
virtual void ConfigureWbs() { } virtual void ConfigureWbs() { }
protected:
virtual ~BluetoothHandsfreeResultHandler() { }
}; };
class BluetoothHandsfreeInterface class BluetoothHandsfreeInterface
@ -277,8 +279,6 @@ protected:
class BluetoothA2dpNotificationHandler class BluetoothA2dpNotificationHandler
{ {
public: public:
virtual ~BluetoothA2dpNotificationHandler();
virtual void virtual void
ConnectionStateNotification(BluetoothA2dpConnectionState aState, ConnectionStateNotification(BluetoothA2dpConnectionState aState,
const nsAString& aBdAddr) const nsAString& aBdAddr)
@ -298,6 +298,8 @@ public:
protected: protected:
BluetoothA2dpNotificationHandler() BluetoothA2dpNotificationHandler()
{ } { }
virtual ~BluetoothA2dpNotificationHandler();
}; };
class BluetoothA2dpResultHandler class BluetoothA2dpResultHandler
@ -305,8 +307,6 @@ class BluetoothA2dpResultHandler
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothA2dpResultHandler) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothA2dpResultHandler)
virtual ~BluetoothA2dpResultHandler() { }
virtual void OnError(BluetoothStatus aStatus) virtual void OnError(BluetoothStatus aStatus)
{ {
BT_WARNING("Received error code %d", (int)aStatus); BT_WARNING("Received error code %d", (int)aStatus);
@ -316,6 +316,9 @@ public:
virtual void Cleanup() { } virtual void Cleanup() { }
virtual void Connect() { } virtual void Connect() { }
virtual void Disconnect() { } virtual void Disconnect() { }
protected:
virtual ~BluetoothA2dpResultHandler() { }
}; };
class BluetoothA2dpInterface class BluetoothA2dpInterface
@ -342,8 +345,6 @@ protected:
class BluetoothAvrcpNotificationHandler class BluetoothAvrcpNotificationHandler
{ {
public: public:
virtual ~BluetoothAvrcpNotificationHandler();
virtual void virtual void
GetPlayStatusNotification() GetPlayStatusNotification()
{ } { }
@ -400,6 +401,8 @@ public:
protected: protected:
BluetoothAvrcpNotificationHandler() BluetoothAvrcpNotificationHandler()
{ } { }
virtual ~BluetoothAvrcpNotificationHandler();
}; };
class BluetoothAvrcpResultHandler class BluetoothAvrcpResultHandler
@ -407,8 +410,6 @@ class BluetoothAvrcpResultHandler
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothAvrcpResultHandler) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothAvrcpResultHandler)
virtual ~BluetoothAvrcpResultHandler() { }
virtual void OnError(BluetoothStatus aStatus) virtual void OnError(BluetoothStatus aStatus)
{ {
BT_WARNING("Received error code %d", (int)aStatus); BT_WARNING("Received error code %d", (int)aStatus);
@ -433,6 +434,9 @@ public:
virtual void RegisterNotificationRsp() { } virtual void RegisterNotificationRsp() { }
virtual void SetVolume() { } virtual void SetVolume() { }
protected:
virtual ~BluetoothAvrcpResultHandler() { }
}; };
class BluetoothAvrcpInterface class BluetoothAvrcpInterface
@ -491,8 +495,6 @@ protected:
class BluetoothNotificationHandler class BluetoothNotificationHandler
{ {
public: public:
virtual ~BluetoothNotificationHandler();
virtual void AdapterStateChangedNotification(bool aState) { } virtual void AdapterStateChangedNotification(bool aState) { }
virtual void AdapterPropertiesNotification( virtual void AdapterPropertiesNotification(
BluetoothStatus aStatus, int aNumProperties, BluetoothStatus aStatus, int aNumProperties,
@ -533,6 +535,8 @@ public:
protected: protected:
BluetoothNotificationHandler() BluetoothNotificationHandler()
{ } { }
virtual ~BluetoothNotificationHandler();
}; };
class BluetoothResultHandler class BluetoothResultHandler
@ -540,8 +544,6 @@ class BluetoothResultHandler
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothResultHandler) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothResultHandler)
virtual ~BluetoothResultHandler() { }
virtual void OnError(BluetoothStatus aStatus) virtual void OnError(BluetoothStatus aStatus)
{ {
BT_LOGR("Received error code %d", aStatus); BT_LOGR("Received error code %d", aStatus);
@ -581,6 +583,9 @@ public:
virtual void LeTestMode() { } virtual void LeTestMode() { }
virtual void ReadEnergyInfo() { } virtual void ReadEnergyInfo() { }
protected:
virtual ~BluetoothResultHandler() { }
}; };
class BluetoothInterface class BluetoothInterface

View File

@ -39,6 +39,7 @@ public:
MOZ_ASSERT(aController); MOZ_ASSERT(aController);
} }
protected:
virtual ~CheckProfileStatusCallback() virtual ~CheckProfileStatusCallback()
{ {
mController = nullptr; mController = nullptr;

View File

@ -33,11 +33,12 @@ class BluetoothProfileResultHandler
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothProfileResultHandler); NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothProfileResultHandler);
virtual ~BluetoothProfileResultHandler() { }
virtual void OnError(nsresult aResult) { } virtual void OnError(nsresult aResult) { }
virtual void Init() { } virtual void Init() { }
virtual void Deinit() { } virtual void Deinit() { }
protected:
virtual ~BluetoothProfileResultHandler() { }
}; };
class BluetoothProfileManagerBase : public nsIObserver class BluetoothProfileManagerBase : public nsIObserver

View File

@ -27,11 +27,13 @@ public:
NS_DECL_NSIICCLISTENER NS_DECL_NSIICCLISTENER
IccListener() { } IccListener() { }
virtual ~IccListener() { }
bool Listen(bool aStart); bool Listen(bool aStart);
void SetOwner(BluetoothRilListener *aOwner); void SetOwner(BluetoothRilListener *aOwner);
protected:
virtual ~IccListener() { }
private: private:
BluetoothRilListener* mOwner; BluetoothRilListener* mOwner;
}; };
@ -44,10 +46,12 @@ public:
MobileConnectionListener(uint32_t aClientId) MobileConnectionListener(uint32_t aClientId)
: mClientId(aClientId) { } : mClientId(aClientId) { }
virtual ~MobileConnectionListener() { }
bool Listen(bool aStart); bool Listen(bool aStart);
protected:
virtual ~MobileConnectionListener() { }
private: private:
uint32_t mClientId; uint32_t mClientId;
}; };
@ -59,10 +63,12 @@ public:
NS_DECL_NSITELEPHONYLISTENER NS_DECL_NSITELEPHONYLISTENER
TelephonyListener() { } TelephonyListener() { }
virtual ~TelephonyListener() { }
bool Listen(bool aStart); bool Listen(bool aStart);
protected:
virtual ~TelephonyListener() { }
private: private:
nsresult HandleCallInfo(nsITelephonyCallInfo* aInfo, bool aSend); nsresult HandleCallInfo(nsITelephonyCallInfo* aInfo, bool aSend);
}; };

View File

@ -179,6 +179,9 @@ public:
BT_WARNING("Unable to get value for '" BLUETOOTH_ENABLED_SETTING "'"); BT_WARNING("Unable to get value for '" BLUETOOTH_ENABLED_SETTING "'");
return NS_OK; return NS_OK;
} }
protected:
~StartupTask() { }
}; };
NS_IMPL_ISUPPORTS(BluetoothService::StartupTask, nsISettingsServiceCallback); NS_IMPL_ISUPPORTS(BluetoothService::StartupTask, nsISettingsServiceCallback);

View File

@ -35,7 +35,6 @@ public:
static BluetoothA2dpManager* Get(); static BluetoothA2dpManager* Get();
static void InitA2dpInterface(BluetoothProfileResultHandler* aRes); static void InitA2dpInterface(BluetoothProfileResultHandler* aRes);
static void DeinitA2dpInterface(BluetoothProfileResultHandler* aRes); static void DeinitA2dpInterface(BluetoothProfileResultHandler* aRes);
virtual ~BluetoothA2dpManager();
void OnConnectError(); void OnConnectError();
void OnDisconnectError(); void OnDisconnectError();
@ -65,6 +64,9 @@ public:
void GetTitle(nsAString& aTitle); void GetTitle(nsAString& aTitle);
void GetArtist(nsAString& aArtist); void GetArtist(nsAString& aArtist);
protected:
virtual ~BluetoothA2dpManager();
private: private:
BluetoothA2dpManager(); BluetoothA2dpManager();
void ResetA2dp(); void ResetA2dp();

View File

@ -16,12 +16,13 @@ class BluetoothSetupResultHandler
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothSetupResultHandler) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothSetupResultHandler)
virtual ~BluetoothSetupResultHandler();
virtual void OnError(BluetoothStatus aStatus); virtual void OnError(BluetoothStatus aStatus);
virtual void RegisterModule(); virtual void RegisterModule();
virtual void UnregisterModule(); virtual void UnregisterModule();
virtual void Configuration(); virtual void Configuration();
protected:
virtual ~BluetoothSetupResultHandler();
}; };
END_BLUETOOTH_NAMESPACE END_BLUETOOTH_NAMESPACE

View File

@ -43,7 +43,6 @@ public:
static const int MAX_PACKET_LENGTH = 0xFFFE; static const int MAX_PACKET_LENGTH = 0xFFFE;
virtual ~BluetoothOppManager();
static BluetoothOppManager* Get(); static BluetoothOppManager* Get();
void ClientDataHandler(mozilla::ipc::UnixSocketRawData* aMessage); void ClientDataHandler(mozilla::ipc::UnixSocketRawData* aMessage);
void ServerDataHandler(mozilla::ipc::UnixSocketRawData* aMessage); void ServerDataHandler(mozilla::ipc::UnixSocketRawData* aMessage);
@ -73,6 +72,9 @@ public:
virtual void OnSocketConnectError(BluetoothSocket* aSocket) MOZ_OVERRIDE; virtual void OnSocketConnectError(BluetoothSocket* aSocket) MOZ_OVERRIDE;
virtual void OnSocketDisconnect(BluetoothSocket* aSocket) MOZ_OVERRIDE; virtual void OnSocketDisconnect(BluetoothSocket* aSocket) MOZ_OVERRIDE;
protected:
virtual ~BluetoothOppManager();
private: private:
BluetoothOppManager(); BluetoothOppManager();
bool Init(); bool Init();

View File

@ -29,13 +29,15 @@ public:
} }
static BluetoothHfpManager* Get(); static BluetoothHfpManager* Get();
virtual ~BluetoothHfpManager() { }
static void InitHfpInterface(BluetoothProfileResultHandler* aRes); static void InitHfpInterface(BluetoothProfileResultHandler* aRes);
static void DeinitHfpInterface(BluetoothProfileResultHandler* aRes); static void DeinitHfpInterface(BluetoothProfileResultHandler* aRes);
bool ConnectSco(); bool ConnectSco();
bool DisconnectSco(); bool DisconnectSco();
protected:
virtual ~BluetoothHfpManager() { }
private: private:
BluetoothHfpManager() { } BluetoothHfpManager() { }
bool Init(); bool Init();

View File

@ -73,7 +73,8 @@ IsSupportedChld(const int aChld) {
return (aChld >= 0 && aChld <= 3); return (aChld >= 0 && aChld <= 3);
} }
class BluetoothHfpManager::GetVolumeTask MOZ_FINAL : public nsISettingsServiceCallback class BluetoothHfpManager::GetVolumeTask MOZ_FINAL
: public nsISettingsServiceCallback
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
@ -103,6 +104,9 @@ public:
BT_WARNING("Unable to get value for '" AUDIO_VOLUME_BT_SCO_ID "'"); BT_WARNING("Unable to get value for '" AUDIO_VOLUME_BT_SCO_ID "'");
return NS_OK; return NS_OK;
} }
protected:
~GetVolumeTask() { }
}; };
class BluetoothHfpManager::CloseScoTask : public Task class BluetoothHfpManager::CloseScoTask : public Task

View File

@ -88,7 +88,6 @@ public:
} }
static BluetoothHfpManager* Get(); static BluetoothHfpManager* Get();
virtual ~BluetoothHfpManager();
static void InitHfpInterface(BluetoothProfileResultHandler* aRes); static void InitHfpInterface(BluetoothProfileResultHandler* aRes);
static void DeinitHfpInterface(BluetoothProfileResultHandler* aRes); static void DeinitHfpInterface(BluetoothProfileResultHandler* aRes);
@ -138,6 +137,9 @@ public:
const nsAString& aBdAddress) MOZ_OVERRIDE; const nsAString& aBdAddress) MOZ_OVERRIDE;
void KeyPressedNotification(const nsAString& aBdAddress) MOZ_OVERRIDE; void KeyPressedNotification(const nsAString& aBdAddress) MOZ_OVERRIDE;
protected:
virtual ~BluetoothHfpManager();
private: private:
class GetVolumeTask; class GetVolumeTask;
class CloseScoTask; class CloseScoTask;

View File

@ -31,7 +31,6 @@ public:
}; };
static BluetoothA2dpManager* Get(); static BluetoothA2dpManager* Get();
virtual ~BluetoothA2dpManager();
// A2DP-specific functions // A2DP-specific functions
void HandleSinkPropertyChanged(const BluetoothSignal& aSignal); void HandleSinkPropertyChanged(const BluetoothSignal& aSignal);
@ -55,6 +54,9 @@ public:
uint64_t GetMediaNumber(); uint64_t GetMediaNumber();
void GetTitle(nsAString& aTitle); void GetTitle(nsAString& aTitle);
protected:
virtual ~BluetoothA2dpManager();
private: private:
BluetoothA2dpManager(); BluetoothA2dpManager();
bool Init(); bool Init();

View File

@ -196,6 +196,9 @@ public:
BT_WARNING("Unable to get value for '" AUDIO_VOLUME_BT_SCO_ID "'"); BT_WARNING("Unable to get value for '" AUDIO_VOLUME_BT_SCO_ID "'");
return NS_OK; return NS_OK;
} }
protected:
~GetVolumeTask() { }
}; };
NS_IMPL_ISUPPORTS(BluetoothHfpManager::GetVolumeTask, NS_IMPL_ISUPPORTS(BluetoothHfpManager::GetVolumeTask,

View File

@ -86,7 +86,6 @@ public:
} }
static BluetoothHfpManager* Get(); static BluetoothHfpManager* Get();
~BluetoothHfpManager();
// The following functions are inherited from BluetoothSocketObserver // The following functions are inherited from BluetoothSocketObserver
virtual void ReceiveSocketData( virtual void ReceiveSocketData(
@ -131,6 +130,9 @@ public:
void ToggleCalls(); void ToggleCalls();
#endif #endif
protected:
~BluetoothHfpManager();
private: private:
void ParseAtCommand(const nsACString& aAtCommand, const int aStart, void ParseAtCommand(const nsACString& aAtCommand, const int aStart,
nsTArray<nsCString>& aRetValues); nsTArray<nsCString>& aRetValues);

View File

@ -43,7 +43,6 @@ public:
static const int MAX_PACKET_LENGTH = 0xFFFE; static const int MAX_PACKET_LENGTH = 0xFFFE;
virtual ~BluetoothOppManager();
static BluetoothOppManager* Get(); static BluetoothOppManager* Get();
void ClientDataHandler(mozilla::ipc::UnixSocketRawData* aMessage); void ClientDataHandler(mozilla::ipc::UnixSocketRawData* aMessage);
void ServerDataHandler(mozilla::ipc::UnixSocketRawData* aMessage); void ServerDataHandler(mozilla::ipc::UnixSocketRawData* aMessage);
@ -73,6 +72,9 @@ public:
virtual void OnSocketConnectError(BluetoothSocket* aSocket) MOZ_OVERRIDE; virtual void OnSocketConnectError(BluetoothSocket* aSocket) MOZ_OVERRIDE;
virtual void OnSocketDisconnect(BluetoothSocket* aSocket) MOZ_OVERRIDE; virtual void OnSocketDisconnect(BluetoothSocket* aSocket) MOZ_OVERRIDE;
protected:
virtual ~BluetoothOppManager();
private: private:
BluetoothOppManager(); BluetoothOppManager();
bool Init(); bool Init();