From 888dc8693083b2de7126223a29863ce65769c4f7 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Thu, 12 Mar 2015 13:07:32 +0100 Subject: [PATCH] Bug 1142132: Move helper classes of HFP manager into manager's namespace, r=shuang Keeping helper classes in Bluetooth's C++ namespace creates collisions between symbols of different managers' helpers. Moving HFP helpers into the namespace of |BluetoothHfpManager| fixes this problem for HFP. --- .../bluedroid/hfp/BluetoothHfpManager.cpp | 79 ++++++++++--------- .../bluedroid/hfp/BluetoothHfpManager.h | 23 +++++- 2 files changed, 63 insertions(+), 39 deletions(-) diff --git a/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp b/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp index 3df17a2169ea..1121c0704926 100644 --- a/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp +++ b/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp @@ -273,13 +273,14 @@ BluetoothHfpManager::Init() return true; } -class CleanupInitResultHandler MOZ_FINAL : public BluetoothHandsfreeResultHandler +class BluetoothHfpManager::CleanupInitResultHandler MOZ_FINAL + : public BluetoothHandsfreeResultHandler { public: CleanupInitResultHandler(BluetoothHandsfreeInterface* aInterface, BluetoothProfileResultHandler* aRes) - : mInterface(aInterface) - , mRes(aRes) + : mInterface(aInterface) + , mRes(aRes) { MOZ_ASSERT(mInterface); } @@ -322,11 +323,12 @@ private: nsRefPtr mRes; }; -class InitResultHandlerRunnable MOZ_FINAL : public nsRunnable +class BluetoothHfpManager::InitResultHandlerRunnable MOZ_FINAL + : public nsRunnable { public: InitResultHandlerRunnable(CleanupInitResultHandler* aRes) - : mRes(aRes) + : mRes(aRes) { MOZ_ASSERT(mRes); } @@ -341,13 +343,14 @@ private: nsRefPtr mRes; }; -class OnErrorProfileResultHandlerRunnable MOZ_FINAL : public nsRunnable +class BluetoothHfpManager::OnErrorProfileResultHandlerRunnable MOZ_FINAL + : public nsRunnable { public: OnErrorProfileResultHandlerRunnable(BluetoothProfileResultHandler* aRes, nsresult aRv) - : mRes(aRes) - , mRv(aRv) + : mRes(aRes) + , mRv(aRv) { MOZ_ASSERT(mRes); } @@ -426,11 +429,12 @@ BluetoothHfpManager::~BluetoothHfpManager() hal::UnregisterBatteryObserver(this); } -class CleanupResultHandler MOZ_FINAL : public BluetoothHandsfreeResultHandler +class BluetoothHfpManager::CleanupResultHandler MOZ_FINAL + : public BluetoothHandsfreeResultHandler { public: CleanupResultHandler(BluetoothProfileResultHandler* aRes) - : mRes(aRes) + : mRes(aRes) { } void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE @@ -456,11 +460,12 @@ private: nsRefPtr mRes; }; -class DeinitResultHandlerRunnable MOZ_FINAL : public nsRunnable +class BluetoothHfpManager::DeinitResultHandlerRunnable MOZ_FINAL + : public nsRunnable { public: DeinitResultHandlerRunnable(BluetoothProfileResultHandler* aRes) - : mRes(aRes) + : mRes(aRes) { MOZ_ASSERT(mRes); } @@ -606,8 +611,8 @@ BluetoothHfpManager::NotifyDialer(const nsAString& aCommand) BT_ENSURE_TRUE_VOID_BROADCAST_SYSMSG(type, parameters); } -class VolumeControlResultHandler MOZ_FINAL -: public BluetoothHandsfreeResultHandler +class BluetoothHfpManager::VolumeControlResultHandler MOZ_FINAL + : public BluetoothHandsfreeResultHandler { public: void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE @@ -743,8 +748,8 @@ BluetoothHfpManager::HandleShutdown() sBluetoothHfpManager = nullptr; } -class ClccResponseResultHandler MOZ_FINAL -: public BluetoothHandsfreeResultHandler +class BluetoothHfpManager::ClccResponseResultHandler MOZ_FINAL + : public BluetoothHandsfreeResultHandler { public: void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE @@ -780,8 +785,8 @@ BluetoothHfpManager::SendCLCC(Call& aCall, int aIndex) aCall.mType, mDeviceAddress, new ClccResponseResultHandler()); } -class FormattedAtResponseResultHandler MOZ_FINAL -: public BluetoothHandsfreeResultHandler +class BluetoothHfpManager::FormattedAtResponseResultHandler MOZ_FINAL + : public BluetoothHandsfreeResultHandler { public: void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE @@ -800,8 +805,8 @@ BluetoothHfpManager::SendLine(const char* aMessage) aMessage, mDeviceAddress, new FormattedAtResponseResultHandler()); } -class AtResponseResultHandler MOZ_FINAL -: public BluetoothHandsfreeResultHandler +class BluetoothHfpManager::AtResponseResultHandler MOZ_FINAL + : public BluetoothHandsfreeResultHandler { public: void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE @@ -820,8 +825,8 @@ BluetoothHfpManager::SendResponse(BluetoothHandsfreeAtResponse aResponseCode) aResponseCode, 0, mDeviceAddress, new AtResponseResultHandler()); } -class PhoneStateChangeResultHandler MOZ_FINAL -: public BluetoothHandsfreeResultHandler +class BluetoothHfpManager::PhoneStateChangeResultHandler MOZ_FINAL + : public BluetoothHandsfreeResultHandler { public: void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE @@ -852,8 +857,8 @@ BluetoothHfpManager::UpdatePhoneCIND(uint32_t aCallIndex) new PhoneStateChangeResultHandler()); } -class DeviceStatusNotificationResultHandler MOZ_FINAL -: public BluetoothHandsfreeResultHandler +class BluetoothHfpManager::DeviceStatusNotificationResultHandler MOZ_FINAL + : public BluetoothHandsfreeResultHandler { public: void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE @@ -1108,8 +1113,8 @@ BluetoothHfpManager::ToggleCalls() nsITelephonyService::CALL_STATE_CONNECTED; } -class ConnectAudioResultHandler MOZ_FINAL -: public BluetoothHandsfreeResultHandler +class BluetoothHfpManager::ConnectAudioResultHandler MOZ_FINAL + : public BluetoothHandsfreeResultHandler { public: void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE @@ -1134,8 +1139,8 @@ BluetoothHfpManager::ConnectSco() return true; } -class DisconnectAudioResultHandler MOZ_FINAL -: public BluetoothHandsfreeResultHandler +class BluetoothHfpManager::DisconnectAudioResultHandler MOZ_FINAL + : public BluetoothHandsfreeResultHandler { public: void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE @@ -1180,11 +1185,12 @@ BluetoothHfpManager::OnConnectError() mDeviceAddress.Truncate(); } -class ConnectResultHandler MOZ_FINAL : public BluetoothHandsfreeResultHandler +class BluetoothHfpManager::ConnectResultHandler MOZ_FINAL + : public BluetoothHandsfreeResultHandler { public: ConnectResultHandler(BluetoothHfpManager* aHfpManager) - : mHfpManager(aHfpManager) + : mHfpManager(aHfpManager) { MOZ_ASSERT(mHfpManager); } @@ -1233,11 +1239,12 @@ BluetoothHfpManager::OnDisconnectError() mController->NotifyCompletion(NS_LITERAL_STRING(ERR_CONNECTION_FAILED)); } -class DisconnectResultHandler MOZ_FINAL : public BluetoothHandsfreeResultHandler +class BluetoothHfpManager::DisconnectResultHandler MOZ_FINAL + : public BluetoothHandsfreeResultHandler { public: DisconnectResultHandler(BluetoothHfpManager* aHfpManager) - : mHfpManager(aHfpManager) + : mHfpManager(aHfpManager) { MOZ_ASSERT(mHfpManager); } @@ -1510,8 +1517,8 @@ BluetoothHfpManager::CnumNotification(const nsAString& aBdAddress) SendResponse(HFP_AT_RESPONSE_OK); } -class CindResponseResultHandler MOZ_FINAL -: public BluetoothHandsfreeResultHandler +class BluetoothHfpManager::CindResponseResultHandler MOZ_FINAL + : public BluetoothHandsfreeResultHandler { public: void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE @@ -1540,8 +1547,8 @@ BluetoothHfpManager::CindNotification(const nsAString& aBdAddress) new CindResponseResultHandler()); } -class CopsResponseResultHandler MOZ_FINAL -: public BluetoothHandsfreeResultHandler +class BluetoothHfpManager::CopsResponseResultHandler MOZ_FINAL + : public BluetoothHandsfreeResultHandler { public: void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE diff --git a/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.h b/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.h index 9adb87644fb5..c4b6ad9ed650 100644 --- a/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.h +++ b/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.h @@ -141,11 +141,28 @@ protected: virtual ~BluetoothHfpManager(); private: - class GetVolumeTask; - class CloseScoTask; + class AtResponseResultHandler; + class CindResponseResultHandler; + class ConnectAudioResultHandler; + class ConnectResultHandler; + class CopsResponseResultHandler; + class ClccResponseResultHandler; + class CleanupInitResultHandler; + class CleanupResultHandler; class CloseScoRunnable; - class RespondToBLDNTask; + class CloseScoTask; + class DeinitResultHandlerRunnable; + class DeviceStatusNotificationResultHandler; + class DisconnectAudioResultHandler; + class DisconnectResultHandler; + class FormattedAtResponseResultHandler; + class GetVolumeTask; + class InitResultHandlerRunnable; class MainThreadTask; + class OnErrorProfileResultHandlerRunnable; + class PhoneStateChangeResultHandler; + class RespondToBLDNTask; + class VolumeControlResultHandler; friend class BluetoothHfpManagerObserver; friend class GetVolumeTask;