OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_profile_chromeos.h" | 5 #include "device/bluetooth/bluetooth_profile_chromeos.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 callback.Run(REJECTED); | 150 callback.Run(REJECTED); |
151 return; | 151 return; |
152 } | 152 } |
153 | 153 |
154 // Punt descriptor validity check to a worker thread where i/o is permitted; | 154 // Punt descriptor validity check to a worker thread where i/o is permitted; |
155 // on return we'll fetch the adapter and then call the connection callback. | 155 // on return we'll fetch the adapter and then call the connection callback. |
156 // | 156 // |
157 // base::Passed is used to take ownership of the file descriptor during the | 157 // base::Passed is used to take ownership of the file descriptor during the |
158 // CheckValidity() call and pass that ownership to the GetAdapter() call. | 158 // CheckValidity() call and pass that ownership to the GetAdapter() call. |
159 base::PostTaskAndReplyWithResult( | 159 base::PostTaskAndReplyWithResult( |
160 base::WorkerPool::GetTaskRunner(false), | 160 base::WorkerPool::GetTaskRunner(false).get(), |
161 FROM_HERE, | 161 FROM_HERE, |
162 base::Bind(&CheckValidity, base::Passed(&fd)), | 162 base::Bind(&CheckValidity, base::Passed(&fd)), |
163 base::Bind(&BluetoothProfileChromeOS::GetAdapter, | 163 base::Bind(&BluetoothProfileChromeOS::GetAdapter, |
164 weak_ptr_factory_.GetWeakPtr(), | 164 weak_ptr_factory_.GetWeakPtr(), |
165 device_path, | 165 device_path, |
166 options, | 166 options, |
167 callback)); | 167 callback)); |
168 } | 168 } |
169 | 169 |
170 void BluetoothProfileChromeOS::RequestDisconnection( | 170 void BluetoothProfileChromeOS::RequestDisconnection( |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 static_cast<BluetoothAdapterChromeOS*>(adapter.get())-> | 244 static_cast<BluetoothAdapterChromeOS*>(adapter.get())-> |
245 GetDeviceWithPath(device_path); | 245 GetDeviceWithPath(device_path); |
246 DCHECK(device); | 246 DCHECK(device); |
247 | 247 |
248 scoped_refptr<BluetoothSocket> socket(( | 248 scoped_refptr<BluetoothSocket> socket(( |
249 BluetoothSocketChromeOS::Create(fd.get()))); | 249 BluetoothSocketChromeOS::Create(fd.get()))); |
250 connection_callback_.Run(device, socket); | 250 connection_callback_.Run(device, socket); |
251 } | 251 } |
252 | 252 |
253 } // namespace chromeos | 253 } // namespace chromeos |
OLD | NEW |