| Index: device/bluetooth/bluetooth_socket_win.h
|
| diff --git a/device/bluetooth/bluetooth_socket_win.h b/device/bluetooth/bluetooth_socket_win.h
|
| index 41713e713097d7c7c377ddaee04cebe7a8f4cd60..adfe89c4f2653169865ed6b30f74f665844c9ec1 100644
|
| --- a/device/bluetooth/bluetooth_socket_win.h
|
| +++ b/device/bluetooth/bluetooth_socket_win.h
|
| @@ -7,15 +7,21 @@
|
|
|
| #include <WinSock2.h>
|
|
|
| +#include <queue>
|
| #include <string>
|
|
|
| +#include "base/memory/linked_ptr.h"
|
| #include "base/memory/ref_counted.h"
|
| +#include "base/threading/thread_checker.h"
|
| +#include "device/bluetooth/bluetooth_service_record_win.h"
|
| #include "device/bluetooth/bluetooth_socket.h"
|
| +#include "net/base/net_log.h"
|
|
|
| namespace net {
|
|
|
| +class IOBufferWithSize;
|
| class DrainableIOBuffer;
|
| -class GrowableIOBuffer;
|
| +class TCPSocketWin;
|
|
|
| } // namespace net
|
|
|
| @@ -28,21 +34,61 @@ class BluetoothServiceRecord;
|
| class BluetoothSocketWin : public BluetoothSocket {
|
| public:
|
| static scoped_refptr<BluetoothSocket> CreateBluetoothSocket(
|
| - const BluetoothServiceRecord& service_record);
|
| + const BluetoothServiceRecord& service_record,
|
| + scoped_refptr<base::SequencedTaskRunner> task_runner,
|
| + net::NetLog* net_log,
|
| + const net::NetLog::Source& source);
|
|
|
| - // BluetoothSocket override
|
| - virtual bool Receive(net::GrowableIOBuffer* buffer) OVERRIDE;
|
| - virtual bool Send(net::DrainableIOBuffer* buffer) OVERRIDE;
|
| - virtual std::string GetLastErrorMessage() const OVERRIDE;
|
| + // Overriden from BluetoothSocket:
|
| + virtual void Connect(const base::Closure& success_callback,
|
| + const ErrorCompletionCallback& error_callback) OVERRIDE;
|
| +
|
| + virtual void Disconnect(const base::Closure& callback) OVERRIDE;
|
| +
|
| + virtual void Receive(int count,
|
| + const ReceiveCompletionCallback& success_callback,
|
| + const ReceiveErrorCompletionCallback& error_callback)
|
| + OVERRIDE;
|
| + virtual void Send(scoped_refptr<net::DrainableIOBuffer> buffer,
|
| + const SendCompletionCallback& success_callback,
|
| + const ErrorCompletionCallback& error_callback) OVERRIDE;
|
|
|
| protected:
|
| virtual ~BluetoothSocketWin();
|
|
|
| private:
|
| - explicit BluetoothSocketWin(SOCKET fd);
|
| -
|
| - const SOCKET fd_;
|
| - std::string error_message_;
|
| + struct WriteRequest {
|
| + scoped_refptr<net::DrainableIOBuffer> buffer;
|
| + SendCompletionCallback success_callback;
|
| + ErrorCompletionCallback error_callback;
|
| + };
|
| +
|
| + BluetoothSocketWin(scoped_refptr<base::SequencedTaskRunner> task_runner,
|
| + net::NetLog* net_log,
|
| + const net::NetLog::Source& source);
|
| +
|
| + void SendFrontWriteRequest();
|
| + void OnSocketWriteComplete(const SendCompletionCallback& success_callback,
|
| + const ErrorCompletionCallback& error_callback,
|
| + int net_status);
|
| + void OnSocketReadComplete(
|
| + const ReceiveCompletionCallback& success_callback,
|
| + const ReceiveErrorCompletionCallback& error_callback,
|
| + int send_result);
|
| +
|
| + base::ThreadChecker thread_checker_;
|
| + scoped_refptr<base::SequencedTaskRunner> task_runner_;
|
| + net::NetLog* net_log_;
|
| + const net::NetLog::Source source_;
|
| + std::string device_address_;
|
| + bool supports_rfcomm_;
|
| + uint8 rfcomm_channel_;
|
| + BTH_ADDR bth_addr_;
|
| + scoped_ptr<net::TCPSocketWin> socket_win_;
|
| + // Queue of pending writes. The buffer at the front of the queue is the one
|
| + // being written.
|
| + std::queue<linked_ptr<WriteRequest> > write_queue_;
|
| + scoped_refptr<net::IOBufferWithSize> read_buffer_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(BluetoothSocketWin);
|
| };
|
|
|