diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp index cc25a378203..dacb5e24197 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp @@ -1702,16 +1702,15 @@ public: private: BluetoothDaemonInterface* mInterface; BluetoothDaemonInterface::Channel mChannel; - BluetoothDaemonPDUConsumer* mConsumer; }; BluetoothDaemonChannel::BluetoothDaemonChannel( BluetoothDaemonInterface* aInterface, BluetoothDaemonInterface::Channel aChannel, BluetoothDaemonPDUConsumer* aConsumer) - : mInterface(aInterface) + : BluetoothDaemonConnection(aConsumer) + , mInterface(aInterface) , mChannel(aChannel) - , mConsumer(aConsumer) { } void @@ -1744,7 +1743,7 @@ BluetoothDaemonChannel::OnDisconnect() ConnectionOrientedSocketIO* BluetoothDaemonChannel::GetIO() { - return PrepareAccept(mConsumer); + return PrepareAccept(); } // diff --git a/ipc/bluetooth/BluetoothDaemonConnection.cpp b/ipc/bluetooth/BluetoothDaemonConnection.cpp index 2f9adc7aaff..b2e89695eb3 100644 --- a/ipc/bluetooth/BluetoothDaemonConnection.cpp +++ b/ipc/bluetooth/BluetoothDaemonConnection.cpp @@ -431,25 +431,28 @@ BluetoothDaemonConnectionIO::ShutdownOnIOThread() // BluetoothDaemonConnection // -BluetoothDaemonConnection::BluetoothDaemonConnection() - : mIO(nullptr) -{ } +BluetoothDaemonConnection::BluetoothDaemonConnection( + BluetoothDaemonPDUConsumer* aConsumer) + : mConsumer(aConsumer) + , mIO(nullptr) +{ + MOZ_ASSERT(mConsumer); +} BluetoothDaemonConnection::~BluetoothDaemonConnection() { } ConnectionOrientedSocketIO* -BluetoothDaemonConnection::PrepareAccept(BluetoothDaemonPDUConsumer* aConsumer) +BluetoothDaemonConnection::PrepareAccept() { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(!mIO); - MOZ_ASSERT(aConsumer); SetConnectionStatus(SOCKET_CONNECTING); mIO = new BluetoothDaemonConnectionIO( XRE_GetIOMessageLoop(), -1, UnixSocketWatcher::SOCKET_IS_CONNECTING, - this, aConsumer); + this, mConsumer); return mIO; } diff --git a/ipc/bluetooth/BluetoothDaemonConnection.h b/ipc/bluetooth/BluetoothDaemonConnection.h index a110b5beecf..16b3901f972 100644 --- a/ipc/bluetooth/BluetoothDaemonConnection.h +++ b/ipc/bluetooth/BluetoothDaemonConnection.h @@ -113,7 +113,7 @@ protected: class BluetoothDaemonConnection : public ConnectionOrientedSocket { public: - BluetoothDaemonConnection(); + BluetoothDaemonConnection(BluetoothDaemonPDUConsumer* aConsumer); virtual ~BluetoothDaemonConnection(); // Methods for |ConnectionOrientedSocket| @@ -136,10 +136,10 @@ protected: // Prepares an instance of |BluetoothDaemonConnection| in DISCONNECTED // state for accepting a connection. Subclasses implementing |GetIO| // need to call this method. - ConnectionOrientedSocketIO* - PrepareAccept(BluetoothDaemonPDUConsumer* aConsumer); + ConnectionOrientedSocketIO* PrepareAccept(); private: + BluetoothDaemonPDUConsumer* mConsumer; BluetoothDaemonConnectionIO* mIO; };