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();
virtual ~BluetoothHidManager();
// HID-specific functions
void HandleInputPropertyChanged(const BluetoothSignal& aSignal);
protected:
virtual ~BluetoothHidManager();
private:
BluetoothHidManager();
bool Init();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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