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 #include "device/bluetooth/bluetooth_socket_net.h" | 5 #include "device/bluetooth/bluetooth_socket_net.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/linked_ptr.h" | 14 #include "base/memory/linked_ptr.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/sequenced_task_runner.h" | 16 #include "base/sequenced_task_runner.h" |
17 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
18 #include "device/bluetooth/bluetooth_socket.h" | 18 #include "device/bluetooth/bluetooth_socket.h" |
19 #include "device/bluetooth/bluetooth_socket_thread.h" | 19 #include "device/bluetooth/bluetooth_socket_thread.h" |
20 #include "net/base/io_buffer.h" | 20 #include "net/base/io_buffer.h" |
21 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
22 #include "net/log/net_log.h" | 22 #include "net/log/net_log_source.h" |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 const char kSocketNotConnected[] = "Socket is not connected."; | 26 const char kSocketNotConnected[] = "Socket is not connected."; |
27 | 27 |
28 static void DeactivateSocket( | 28 static void DeactivateSocket( |
29 const scoped_refptr<device::BluetoothSocketThread>& socket_thread) { | 29 const scoped_refptr<device::BluetoothSocketThread>& socket_thread) { |
30 socket_thread->OnSocketDeactivate(); | 30 socket_thread->OnSocketDeactivate(); |
31 } | 31 } |
32 | 32 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 success_callback), | 110 success_callback), |
111 base::Bind(&BluetoothSocketNet::PostErrorCompletion, | 111 base::Bind(&BluetoothSocketNet::PostErrorCompletion, |
112 this, | 112 this, |
113 error_callback))); | 113 error_callback))); |
114 } | 114 } |
115 | 115 |
116 void BluetoothSocketNet::ResetData() { | 116 void BluetoothSocketNet::ResetData() { |
117 } | 117 } |
118 | 118 |
119 void BluetoothSocketNet::ResetTCPSocket() { | 119 void BluetoothSocketNet::ResetTCPSocket() { |
120 tcp_socket_.reset(new net::TCPSocket(NULL, NULL, net::NetLog::Source())); | 120 tcp_socket_.reset(new net::TCPSocket(NULL, NULL, net::NetLogSource())); |
121 } | 121 } |
122 | 122 |
123 void BluetoothSocketNet::SetTCPSocket( | 123 void BluetoothSocketNet::SetTCPSocket( |
124 std::unique_ptr<net::TCPSocket> tcp_socket) { | 124 std::unique_ptr<net::TCPSocket> tcp_socket) { |
125 tcp_socket_ = std::move(tcp_socket); | 125 tcp_socket_ = std::move(tcp_socket); |
126 } | 126 } |
127 | 127 |
128 void BluetoothSocketNet::PostSuccess(const base::Closure& callback) { | 128 void BluetoothSocketNet::PostSuccess(const base::Closure& callback) { |
129 ui_task_runner_->PostTask(FROM_HERE, callback); | 129 ui_task_runner_->PostTask(FROM_HERE, callback); |
130 } | 130 } |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 base::Bind(callback, reason, error_message)); | 303 base::Bind(callback, reason, error_message)); |
304 } | 304 } |
305 | 305 |
306 void BluetoothSocketNet::PostSendCompletion( | 306 void BluetoothSocketNet::PostSendCompletion( |
307 const SendCompletionCallback& callback, | 307 const SendCompletionCallback& callback, |
308 int bytes_written) { | 308 int bytes_written) { |
309 ui_task_runner_->PostTask(FROM_HERE, base::Bind(callback, bytes_written)); | 309 ui_task_runner_->PostTask(FROM_HERE, base::Bind(callback, bytes_written)); |
310 } | 310 } |
311 | 311 |
312 } // namespace device | 312 } // namespace device |
OLD | NEW |