OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_NET_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_NET_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_NET_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_NET_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 } // namespace net | 24 } // namespace net |
25 | 25 |
26 namespace device { | 26 namespace device { |
27 | 27 |
28 // This class is a base-class for implementations of BluetoothSocket that can | 28 // This class is a base-class for implementations of BluetoothSocket that can |
29 // use net::TCPSocket. All public methods (including the factory method) must | 29 // use net::TCPSocket. All public methods (including the factory method) must |
30 // be called on the UI thread, while underlying socket operations are | 30 // be called on the UI thread, while underlying socket operations are |
31 // performed on a separate thread. | 31 // performed on a separate thread. |
32 class BluetoothSocketNet : public BluetoothSocket { | 32 class BluetoothSocketNet : public BluetoothSocket { |
33 public: | 33 public: |
34 static scoped_refptr<BluetoothSocketNet> CreateBluetoothSocket( | |
35 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | |
36 scoped_refptr<BluetoothSocketThread> socket_thread, | |
37 net::NetLog* net_log, | |
38 const net::NetLog::Source& source); | |
39 | |
40 // BluetoothSocket: | 34 // BluetoothSocket: |
41 virtual void Close() OVERRIDE; | 35 virtual void Close() OVERRIDE; |
42 virtual void Disconnect(const base::Closure& callback) OVERRIDE; | 36 virtual void Disconnect(const base::Closure& callback) OVERRIDE; |
43 virtual void Receive(int buffer_size, | 37 virtual void Receive(int buffer_size, |
44 const ReceiveCompletionCallback& success_callback, | 38 const ReceiveCompletionCallback& success_callback, |
45 const ReceiveErrorCompletionCallback& error_callback) | 39 const ReceiveErrorCompletionCallback& error_callback) |
46 OVERRIDE; | 40 OVERRIDE; |
47 virtual void Send(scoped_refptr<net::IOBuffer> buffer, | 41 virtual void Send(scoped_refptr<net::IOBuffer> buffer, |
48 int buffer_size, | 42 int buffer_size, |
49 const SendCompletionCallback& success_callback, | 43 const SendCompletionCallback& success_callback, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 scoped_ptr<net::TCPSocket> tcp_socket_; | 122 scoped_ptr<net::TCPSocket> tcp_socket_; |
129 scoped_refptr<net::IOBufferWithSize> read_buffer_; | 123 scoped_refptr<net::IOBufferWithSize> read_buffer_; |
130 std::queue<linked_ptr<WriteRequest> > write_queue_; | 124 std::queue<linked_ptr<WriteRequest> > write_queue_; |
131 | 125 |
132 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketNet); | 126 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketNet); |
133 }; | 127 }; |
134 | 128 |
135 } // namespace device | 129 } // namespace device |
136 | 130 |
137 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_NET_H_ | 131 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_NET_H_ |
OLD | NEW |