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 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 if (write_queue_.size() == 0) | 251 if (write_queue_.size() == 0) |
252 return; | 252 return; |
253 | 253 |
254 linked_ptr<WriteRequest> request = write_queue_.front(); | 254 linked_ptr<WriteRequest> request = write_queue_.front(); |
255 net::CompletionCallback callback = | 255 net::CompletionCallback callback = |
256 base::Bind(&BluetoothSocketNet::OnSocketWriteComplete, | 256 base::Bind(&BluetoothSocketNet::OnSocketWriteComplete, |
257 this, | 257 this, |
258 request->success_callback, | 258 request->success_callback, |
259 request->error_callback); | 259 request->error_callback); |
260 int send_result = | 260 int send_result = |
261 tcp_socket_->Write(request->buffer, request->buffer_size, callback); | 261 tcp_socket_->Write(request->buffer.get(), request->buffer_size, callback); |
262 if (send_result != net::ERR_IO_PENDING) { | 262 if (send_result != net::ERR_IO_PENDING) { |
263 callback.Run(send_result); | 263 callback.Run(send_result); |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 void BluetoothSocketNet::OnSocketWriteComplete( | 267 void BluetoothSocketNet::OnSocketWriteComplete( |
268 const SendCompletionCallback& success_callback, | 268 const SendCompletionCallback& success_callback, |
269 const ErrorCompletionCallback& error_callback, | 269 const ErrorCompletionCallback& error_callback, |
270 int send_result) { | 270 int send_result) { |
271 DCHECK(socket_thread_->task_runner()->RunsTasksOnCurrentThread()); | 271 DCHECK(socket_thread_->task_runner()->RunsTasksOnCurrentThread()); |
(...skipping 29 matching lines...) Expand all Loading... |
301 base::Bind(callback, reason, error_message)); | 301 base::Bind(callback, reason, error_message)); |
302 } | 302 } |
303 | 303 |
304 void BluetoothSocketNet::PostSendCompletion( | 304 void BluetoothSocketNet::PostSendCompletion( |
305 const SendCompletionCallback& callback, | 305 const SendCompletionCallback& callback, |
306 int bytes_written) { | 306 int bytes_written) { |
307 ui_task_runner_->PostTask(FROM_HERE, base::Bind(callback, bytes_written)); | 307 ui_task_runner_->PostTask(FROM_HERE, base::Bind(callback, bytes_written)); |
308 } | 308 } |
309 | 309 |
310 } // namespace device | 310 } // namespace device |
OLD | NEW |