Bug 1050174: Use |SocketConsumerBase| for Bluetooth sockets (under bluetooth2/), r=btian

This commit is contained in:
Thomas Zimmermann 2014-08-21 09:30:34 +02:00
parent b894debe3f
commit 86dfe18dc2
2 changed files with 16 additions and 2 deletions

View File

@ -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(

View File

@ -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;