Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2191)

Unified Diff: device/bluetooth/bluetooth_socket_win.h

Issue 267633003: Reimplement BluetoothSocketChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Got windows compiling, ship it Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_socket_thread_win.cc ('k') | device/bluetooth/bluetooth_socket_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_socket_win.h
diff --git a/device/bluetooth/bluetooth_socket_win.h b/device/bluetooth/bluetooth_socket_win.h
index 0b4ac901366ee3cd9b94deebac41cb887c6a1a62..195e870f61c74a9e5476709f3d9442688ea714af 100644
--- a/device/bluetooth/bluetooth_socket_win.h
+++ b/device/bluetooth/bluetooth_socket_win.h
@@ -7,40 +7,29 @@
#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 "device/bluetooth/bluetooth_socket_net.h"
#include "net/base/ip_endpoint.h"
-#include "net/base/net_log.h"
#include "net/socket/tcp_socket.h"
-namespace net {
-class IOBuffer;
-class IOBufferWithSize;
-} // namespace net
-
namespace device {
class BluetoothServiceRecord;
-class BluetoothSocketThreadWin;
-// This class is an implementation of BluetoothSocket class for the Windows
-// platform. All public methods (including the factory method) must be called
-// on the UI thread, while underlying socket operations are performed on a
-// separated thread.
-class BluetoothSocketWin : public BluetoothSocket {
+// The BluetoothSocketWin class implements BluetoothSocket for the Microsoft
+// Windows platform.
+class BluetoothSocketWin : public BluetoothSocketNet {
public:
typedef base::Callback<void(scoped_refptr<BluetoothSocketWin>,
const net::IPEndPoint&)> OnNewConnectionCallback;
static scoped_refptr<BluetoothSocketWin> CreateBluetoothSocket(
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
- scoped_refptr<BluetoothSocketThreadWin> socket_thread,
+ scoped_refptr<BluetoothSocketThread> socket_thread,
net::NetLog* net_log,
const net::NetLog::Source& source);
@@ -63,19 +52,8 @@ class BluetoothSocketWin : public BluetoothSocket {
const base::Closure& success_callback,
const ErrorCompletionCallback& error_callback);
- // Overriden from BluetoothSocket:
- virtual void Close() OVERRIDE;
-
- virtual void Disconnect(const base::Closure& callback) OVERRIDE;
-
- virtual void Receive(int buffer_size,
- const ReceiveCompletionCallback& success_callback,
- const ReceiveErrorCompletionCallback& error_callback)
- OVERRIDE;
- virtual void Send(scoped_refptr<net::IOBuffer> buffer,
- int buffer_size,
- const SendCompletionCallback& success_callback,
- const ErrorCompletionCallback& error_callback) OVERRIDE;
+ // BluetoothSocketNet:
+ void ResetData();
protected:
virtual ~BluetoothSocketWin();
@@ -83,52 +61,14 @@ class BluetoothSocketWin : public BluetoothSocket {
private:
struct ServiceRegData;
- struct WriteRequest {
- scoped_refptr<net::IOBuffer> buffer;
- int buffer_size;
- SendCompletionCallback success_callback;
- ErrorCompletionCallback error_callback;
- };
-
BluetoothSocketWin(scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
- scoped_refptr<BluetoothSocketThreadWin> socket_thread,
+ scoped_refptr<BluetoothSocketThread> socket_thread,
net::NetLog* net_log,
const net::NetLog::Source& source);
- void DoClose();
+
void DoConnect(const base::Closure& success_callback,
const ErrorCompletionCallback& error_callback);
- void DoDisconnect(const base::Closure& callback);
- void DoReceive(int buffer_size,
- const ReceiveCompletionCallback& success_callback,
- const ReceiveErrorCompletionCallback& error_callback);
- void DoSend(scoped_refptr<net::IOBuffer> buffer,
- int buffer_size,
- const SendCompletionCallback& success_callback,
- const ErrorCompletionCallback& error_callback);
-
- void PostSuccess(const base::Closure& callback);
- void PostErrorCompletion(const ErrorCompletionCallback& callback,
- const std::string& error);
- void PostReceiveCompletion(const ReceiveCompletionCallback& callback,
- int io_buffer_size,
- scoped_refptr<net::IOBuffer> io_buffer);
- void PostReceiveErrorCompletion(
- const ReceiveErrorCompletionCallback& callback,
- ErrorReason reason,
- const std::string& error_message);
- void PostSendCompletion(const SendCompletionCallback& callback,
- int bytes_written);
-
- 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);
-
void DoStartService(const BluetoothUUID& uuid,
const std::string& name,
int rfcomm_channel,
@@ -140,19 +80,10 @@ class BluetoothSocketWin : public BluetoothSocket {
void OnAcceptOnUI(scoped_ptr<net::TCPSocket> accept_socket,
const net::IPEndPoint& peer_address);
- scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
- scoped_refptr<BluetoothSocketThreadWin> socket_thread_;
- 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::TCPSocket> tcp_socket_;
- // 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_;
scoped_ptr<ServiceRegData> service_reg_data_;
scoped_ptr<net::TCPSocket> accept_socket_;
« no previous file with comments | « device/bluetooth/bluetooth_socket_thread_win.cc ('k') | device/bluetooth/bluetooth_socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698