| 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 <queue> | 7 #include <queue> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/location.h" | 11 #include "base/location.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/sequenced_task_runner.h" | 16 #include "base/sequenced_task_runner.h" |
| 16 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
| 17 #include "device/bluetooth/bluetooth_socket.h" | 18 #include "device/bluetooth/bluetooth_socket.h" |
| 18 #include "device/bluetooth/bluetooth_socket_thread.h" | 19 #include "device/bluetooth/bluetooth_socket_thread.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 114 } |
| 114 | 115 |
| 115 void BluetoothSocketNet::ResetData() { | 116 void BluetoothSocketNet::ResetData() { |
| 116 } | 117 } |
| 117 | 118 |
| 118 void BluetoothSocketNet::ResetTCPSocket() { | 119 void BluetoothSocketNet::ResetTCPSocket() { |
| 119 tcp_socket_.reset(new net::TCPSocket(NULL, net::NetLog::Source())); | 120 tcp_socket_.reset(new net::TCPSocket(NULL, net::NetLog::Source())); |
| 120 } | 121 } |
| 121 | 122 |
| 122 void BluetoothSocketNet::SetTCPSocket(scoped_ptr<net::TCPSocket> tcp_socket) { | 123 void BluetoothSocketNet::SetTCPSocket(scoped_ptr<net::TCPSocket> tcp_socket) { |
| 123 tcp_socket_ = tcp_socket.Pass(); | 124 tcp_socket_ = std::move(tcp_socket); |
| 124 } | 125 } |
| 125 | 126 |
| 126 void BluetoothSocketNet::PostSuccess(const base::Closure& callback) { | 127 void BluetoothSocketNet::PostSuccess(const base::Closure& callback) { |
| 127 ui_task_runner_->PostTask(FROM_HERE, callback); | 128 ui_task_runner_->PostTask(FROM_HERE, callback); |
| 128 } | 129 } |
| 129 | 130 |
| 130 void BluetoothSocketNet::PostErrorCompletion( | 131 void BluetoothSocketNet::PostErrorCompletion( |
| 131 const ErrorCompletionCallback& callback, | 132 const ErrorCompletionCallback& callback, |
| 132 const std::string& error) { | 133 const std::string& error) { |
| 133 ui_task_runner_->PostTask(FROM_HERE, base::Bind(callback, error)); | 134 ui_task_runner_->PostTask(FROM_HERE, base::Bind(callback, error)); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 base::Bind(callback, reason, error_message)); | 302 base::Bind(callback, reason, error_message)); |
| 302 } | 303 } |
| 303 | 304 |
| 304 void BluetoothSocketNet::PostSendCompletion( | 305 void BluetoothSocketNet::PostSendCompletion( |
| 305 const SendCompletionCallback& callback, | 306 const SendCompletionCallback& callback, |
| 306 int bytes_written) { | 307 int bytes_written) { |
| 307 ui_task_runner_->PostTask(FROM_HERE, base::Bind(callback, bytes_written)); | 308 ui_task_runner_->PostTask(FROM_HERE, base::Bind(callback, bytes_written)); |
| 308 } | 309 } |
| 309 | 310 |
| 310 } // namespace device | 311 } // namespace device |
| OLD | NEW |