mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-02 15:15:23 +00:00
Bug 1050174: Use |SocketConsumerBase| for Bluetooth sockets (under bluetooth2/), r=btian
This commit is contained in:
parent
b894debe3f
commit
86dfe18dc2
@ -815,6 +815,8 @@ BluetoothSocket::Connect(const nsAString& aDeviceAddress, int aChannel)
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
NS_ENSURE_FALSE(mImpl, false);
|
||||
|
||||
SetConnectionStatus(SOCKET_CONNECTING);
|
||||
|
||||
mImpl = new DroidSocketImpl(XRE_GetIOMessageLoop(), this);
|
||||
|
||||
// TODO: uuid as argument
|
||||
@ -862,6 +864,8 @@ BluetoothSocket::Listen(int aChannel)
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
NS_ENSURE_FALSE(mImpl, false);
|
||||
|
||||
SetConnectionStatus(SOCKET_LISTENING);
|
||||
|
||||
mImpl = new DroidSocketImpl(XRE_GetIOMessageLoop(), this);
|
||||
|
||||
sBluetoothSocketInterface->Listen(
|
||||
|
@ -8,14 +8,14 @@
|
||||
#define mozilla_dom_bluetooth_BluetoothSocket_h
|
||||
|
||||
#include "BluetoothCommon.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
#include "mozilla/ipc/SocketBase.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothSocketObserver;
|
||||
class DroidSocketImpl;
|
||||
|
||||
class BluetoothSocket : public mozilla::ipc::UnixSocketConsumer
|
||||
class BluetoothSocket : public mozilla::ipc::SocketConsumerBase
|
||||
{
|
||||
public:
|
||||
BluetoothSocket(BluetoothSocketObserver* aObserver,
|
||||
@ -51,6 +51,16 @@ public:
|
||||
void CloseDroidSocket();
|
||||
bool SendDroidSocketData(mozilla::ipc::UnixSocketRawData* aData);
|
||||
|
||||
void CloseSocket() MOZ_OVERRIDE
|
||||
{
|
||||
CloseDroidSocket();
|
||||
}
|
||||
|
||||
bool SendSocketData(mozilla::ipc::UnixSocketRawData* aMessage) MOZ_OVERRIDE
|
||||
{
|
||||
return SendDroidSocketData(aMessage);
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothSocketObserver* mObserver;
|
||||
DroidSocketImpl* mImpl;
|
||||
|
Loading…
Reference in New Issue
Block a user