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/bluez/bluetooth_adapter_bluez.h" | 5 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 base::ThreadTaskRunnerHandle::Get()->PostTask( | 201 base::ThreadTaskRunnerHandle::Get()->PostTask( |
202 FROM_HERE, base::Bind(&BluetoothAdapterBlueZ::Init, | 202 FROM_HERE, base::Bind(&BluetoothAdapterBlueZ::Init, |
203 weak_ptr_factory_.GetWeakPtr())); | 203 weak_ptr_factory_.GetWeakPtr())); |
204 return; | 204 return; |
205 } | 205 } |
206 bluez::BluezDBusManager::Get()->CallWhenObjectManagerSupportIsKnown( | 206 bluez::BluezDBusManager::Get()->CallWhenObjectManagerSupportIsKnown( |
207 base::Bind(&BluetoothAdapterBlueZ::Init, weak_ptr_factory_.GetWeakPtr())); | 207 base::Bind(&BluetoothAdapterBlueZ::Init, weak_ptr_factory_.GetWeakPtr())); |
208 } | 208 } |
209 | 209 |
210 void BluetoothAdapterBlueZ::Init() { | 210 void BluetoothAdapterBlueZ::Init() { |
211 // We've been shutdown before Init() was run. Do nothing. | |
212 if (dbus_is_shutdown_) | |
sky
2016/08/25 17:15:09
I don't know if we need to set initialized_ and ru
Rahul Chaturvedi
2016/08/25 20:21:59
In case a test is waiting on the adapter to get re
sky
2016/08/25 20:27:27
Done.
| |
213 return; | |
214 | |
211 // If the platform doesn't support Object Manager then Bluez 5 is probably | 215 // If the platform doesn't support Object Manager then Bluez 5 is probably |
212 // not present. In this case we just return without initializing anything. | 216 // not present. In this case we just return without initializing anything. |
213 if (!bluez::BluezDBusManager::Get()->IsObjectManagerSupported()) { | 217 if (!bluez::BluezDBusManager::Get()->IsObjectManagerSupported()) { |
214 initialized_ = true; | 218 initialized_ = true; |
215 init_callback_.Run(); | 219 init_callback_.Run(); |
216 return; | 220 return; |
217 } | 221 } |
218 | 222 |
219 bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->AddObserver( | 223 bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->AddObserver( |
220 this); | 224 this); |
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1685 } else if (error_name == bluetooth_adapter::kErrorAlreadyExists) { | 1689 } else if (error_name == bluetooth_adapter::kErrorAlreadyExists) { |
1686 code = BluetoothServiceRecordBlueZ::ErrorCode::ERROR_RECORD_ALREADY_EXISTS; | 1690 code = BluetoothServiceRecordBlueZ::ErrorCode::ERROR_RECORD_ALREADY_EXISTS; |
1687 } else if (error_name == bluetooth_adapter::kErrorNotReady) { | 1691 } else if (error_name == bluetooth_adapter::kErrorNotReady) { |
1688 code = BluetoothServiceRecordBlueZ::ErrorCode::ERROR_ADAPTER_NOT_READY; | 1692 code = BluetoothServiceRecordBlueZ::ErrorCode::ERROR_ADAPTER_NOT_READY; |
1689 } | 1693 } |
1690 | 1694 |
1691 error_callback.Run(code); | 1695 error_callback.Run(code); |
1692 } | 1696 } |
1693 | 1697 |
1694 } // namespace bluez | 1698 } // namespace bluez |
OLD | NEW |