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 "components/proximity_auth/bluetooth_connection.h" | 5 #include "components/proximity_auth/bluetooth_connection.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/numerics/safe_conversions.h" | 11 #include "base/numerics/safe_conversions.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
14 #include "components/proximity_auth/logging/logging.h" | 14 #include "components/proximity_auth/logging/logging.h" |
15 #include "components/proximity_auth/remote_device.h" | 15 #include "components/proximity_auth/remote_device.h" |
16 #include "components/proximity_auth/wire_message.h" | 16 #include "components/proximity_auth/wire_message.h" |
17 #include "device/bluetooth/bluetooth_adapter_factory.h" | 17 #include "device/bluetooth/bluetooth_adapter_factory.h" |
18 #include "device/bluetooth/bluetooth_device.h" | 18 #include "device/bluetooth/bluetooth_device.h" |
19 #include "net/base/io_buffer.h" | 19 #include "net/base/io_buffer.h" |
20 | 20 |
21 namespace proximity_auth { | 21 namespace proximity_auth { |
22 namespace { | 22 namespace { |
23 const int kReceiveBufferSizeBytes = 1024; | 23 const int kReceiveBufferSizeBytes = 1024; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 PA_LOG(WARNING) << "Error receiving bytes: " << error_message; | 198 PA_LOG(WARNING) << "Error receiving bytes: " << error_message; |
199 | 199 |
200 // Post a task to delay the read until the socket is available, as | 200 // Post a task to delay the read until the socket is available, as |
201 // calling StartReceive at this point would error with ERR_IO_PENDING. | 201 // calling StartReceive at this point would error with ERR_IO_PENDING. |
202 base::ThreadTaskRunnerHandle::Get()->PostTask( | 202 base::ThreadTaskRunnerHandle::Get()->PostTask( |
203 FROM_HERE, base::Bind(&BluetoothConnection::StartReceive, | 203 FROM_HERE, base::Bind(&BluetoothConnection::StartReceive, |
204 weak_ptr_factory_.GetWeakPtr())); | 204 weak_ptr_factory_.GetWeakPtr())); |
205 } | 205 } |
206 | 206 |
207 } // namespace proximity_auth | 207 } // namespace proximity_auth |
OLD | NEW |