mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1232941 - Register Observer and listen to NS_XPCOM_SHUTDOWN_OBSERVER_ID for GATT, r=shuang
--HG-- extra : rebase_source : 98094772547ab8c92498175d2dcef36c715a9ee8
This commit is contained in:
parent
4f28efc5fe
commit
42f7e0fe4e
@ -385,10 +385,27 @@ BluetoothGattManager::Get()
|
||||
|
||||
// Create a new instance, register, and return
|
||||
BluetoothGattManager* manager = new BluetoothGattManager();
|
||||
NS_ENSURE_TRUE(manager->Init(), nullptr);
|
||||
sBluetoothGattManager = manager;
|
||||
return sBluetoothGattManager;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothGattManager::Init()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
||||
NS_ENSURE_TRUE(obs, false);
|
||||
|
||||
if (NS_FAILED(obs->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false))) {
|
||||
BT_WARNING("Failed to add observers!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
class BluetoothGattManager::RegisterModuleResultHandler final
|
||||
: public BluetoothSetupResultHandler
|
||||
{
|
||||
|
@ -203,6 +203,7 @@ private:
|
||||
class ServerSendIndicationResultHandler;
|
||||
|
||||
BluetoothGattManager();
|
||||
bool Init();
|
||||
|
||||
void HandleShutdown();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user