| 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 | 24 |
| 25 namespace device { | 25 namespace device { |
| 26 | 26 |
| 27 // This class is a base-class for implementations of BluetoothSocket that can | 27 // This class is a base-class for implementations of BluetoothSocket that can |
| 28 // use net::TCPSocket. All public methods (including the factory method) must | 28 // use net::TCPSocket. All public methods (including the factory method) must |
| 29 // be called on the UI thread, while underlying socket operations are | 29 // be called on the UI thread, while underlying socket operations are |
| 30 // performed on a separate thread. | 30 // performed on a separate thread. |
| 31 class BluetoothSocketNet : public BluetoothSocket { | 31 class BluetoothSocketNet : public BluetoothSocket { |
| 32 public: | 32 public: |
| 33 // BluetoothSocket: | 33 // BluetoothSocket: |
| 34 virtual void Close() OVERRIDE; | 34 virtual void Close() override; |
| 35 virtual void Disconnect(const base::Closure& callback) OVERRIDE; | 35 virtual void Disconnect(const base::Closure& callback) override; |
| 36 virtual void Receive(int buffer_size, | 36 virtual void Receive(int buffer_size, |
| 37 const ReceiveCompletionCallback& success_callback, | 37 const ReceiveCompletionCallback& success_callback, |
| 38 const ReceiveErrorCompletionCallback& error_callback) | 38 const ReceiveErrorCompletionCallback& error_callback) |
| 39 OVERRIDE; | 39 override; |
| 40 virtual void Send(scoped_refptr<net::IOBuffer> buffer, | 40 virtual void Send(scoped_refptr<net::IOBuffer> buffer, |
| 41 int buffer_size, | 41 int buffer_size, |
| 42 const SendCompletionCallback& success_callback, | 42 const SendCompletionCallback& success_callback, |
| 43 const ErrorCompletionCallback& error_callback) OVERRIDE; | 43 const ErrorCompletionCallback& error_callback) override; |
| 44 | 44 |
| 45 protected: | 45 protected: |
| 46 BluetoothSocketNet(scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 46 BluetoothSocketNet(scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
| 47 scoped_refptr<BluetoothSocketThread> socket_thread); | 47 scoped_refptr<BluetoothSocketThread> socket_thread); |
| 48 virtual ~BluetoothSocketNet(); | 48 virtual ~BluetoothSocketNet(); |
| 49 | 49 |
| 50 // Resets locally held data after a socket is closed. Default implementation | 50 // Resets locally held data after a socket is closed. Default implementation |
| 51 // does nothing, subclasses may override. | 51 // does nothing, subclasses may override. |
| 52 virtual void ResetData(); | 52 virtual void ResetData(); |
| 53 | 53 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 scoped_ptr<net::TCPSocket> tcp_socket_; | 114 scoped_ptr<net::TCPSocket> tcp_socket_; |
| 115 scoped_refptr<net::IOBufferWithSize> read_buffer_; | 115 scoped_refptr<net::IOBufferWithSize> read_buffer_; |
| 116 std::queue<linked_ptr<WriteRequest> > write_queue_; | 116 std::queue<linked_ptr<WriteRequest> > write_queue_; |
| 117 | 117 |
| 118 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketNet); | 118 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketNet); |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 } // namespace device | 121 } // namespace device |
| 122 | 122 |
| 123 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_NET_H_ | 123 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_NET_H_ |
| OLD | NEW |