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/logging.h" | 10 #include "base/logging.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 static void DeactivateSocket( | 25 static void DeactivateSocket( |
26 const scoped_refptr<device::BluetoothSocketThread>& socket_thread) { | 26 const scoped_refptr<device::BluetoothSocketThread>& socket_thread) { |
27 socket_thread->OnSocketDeactivate(); | 27 socket_thread->OnSocketDeactivate(); |
28 } | 28 } |
29 | 29 |
30 } // namespace | 30 } // namespace |
31 | 31 |
32 namespace device { | 32 namespace device { |
33 | 33 |
34 // static | |
35 scoped_refptr<BluetoothSocketNet> | |
36 BluetoothSocketNet::CreateBluetoothSocket( | |
37 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | |
38 scoped_refptr<BluetoothSocketThread> socket_thread, | |
39 net::NetLog* net_log, | |
40 const net::NetLog::Source& source) { | |
41 DCHECK(ui_task_runner->RunsTasksOnCurrentThread()); | |
42 | |
43 return make_scoped_refptr( | |
44 new BluetoothSocketNet(ui_task_runner, socket_thread, net_log, source)); | |
45 } | |
46 | |
47 BluetoothSocketNet::WriteRequest::WriteRequest() | 34 BluetoothSocketNet::WriteRequest::WriteRequest() |
48 : buffer_size(0) {} | 35 : buffer_size(0) {} |
49 | 36 |
50 BluetoothSocketNet::WriteRequest::~WriteRequest() {} | 37 BluetoothSocketNet::WriteRequest::~WriteRequest() {} |
51 | 38 |
52 BluetoothSocketNet::BluetoothSocketNet( | 39 BluetoothSocketNet::BluetoothSocketNet( |
53 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 40 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
54 scoped_refptr<BluetoothSocketThread> socket_thread, | 41 scoped_refptr<BluetoothSocketThread> socket_thread, |
55 net::NetLog* net_log, | 42 net::NetLog* net_log, |
56 const net::NetLog::Source& source) | 43 const net::NetLog::Source& source) |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 base::Bind(callback, reason, error_message)); | 311 base::Bind(callback, reason, error_message)); |
325 } | 312 } |
326 | 313 |
327 void BluetoothSocketNet::PostSendCompletion( | 314 void BluetoothSocketNet::PostSendCompletion( |
328 const SendCompletionCallback& callback, | 315 const SendCompletionCallback& callback, |
329 int bytes_written) { | 316 int bytes_written) { |
330 ui_task_runner_->PostTask(FROM_HERE, base::Bind(callback, bytes_written)); | 317 ui_task_runner_->PostTask(FROM_HERE, base::Bind(callback, bytes_written)); |
331 } | 318 } |
332 | 319 |
333 } // namespace device | 320 } // namespace device |
OLD | NEW |