Chromium Code Reviews| Index: device/bluetooth/bluetooth_remote_gatt_service_android.cc |
| diff --git a/device/bluetooth/bluetooth_remote_gatt_service_android.cc b/device/bluetooth/bluetooth_remote_gatt_service_android.cc |
| index 25087b733697c9bab9b56d0437bfcf121a425ae8..66c283ebeb1e7bc3b9e96cf6c874a04b9b2f0ebe 100644 |
| --- a/device/bluetooth/bluetooth_remote_gatt_service_android.cc |
| +++ b/device/bluetooth/bluetooth_remote_gatt_service_android.cc |
| @@ -135,7 +135,7 @@ BluetoothRemoteGattServiceAndroid::GetCharacteristics() const { |
| EnsureCharacteristicsCreated(); |
| std::vector<device::BluetoothRemoteGattCharacteristic*> characteristics; |
| for (const auto& map_iter : characteristics_) |
| - characteristics.push_back(map_iter.second); |
| + characteristics.push_back(map_iter.second.get()); |
| return characteristics; |
| } |
| @@ -150,9 +150,11 @@ BluetoothRemoteGattServiceAndroid::GetCharacteristic( |
| const std::string& identifier) const { |
| EnsureCharacteristicsCreated(); |
| const auto& iter = characteristics_.find(identifier); |
| - if (iter == characteristics_.end()) |
| + if (iter == characteristics_.end()) { |
| return nullptr; |
| - return iter->second; |
| + } |
| + |
| + return iter->second.get(); |
| } |
| void BluetoothRemoteGattServiceAndroid::CreateGattRemoteCharacteristic( |
| @@ -166,13 +168,14 @@ void BluetoothRemoteGattServiceAndroid::CreateGattRemoteCharacteristic( |
| std::string instance_id_string = |
| base::android::ConvertJavaStringToUTF8(env, instance_id); |
| - DCHECK(!characteristics_.contains(instance_id_string)); |
| + // DCHECK(characteristics_.find(instance_id_string) != nullptr); |
|
Reilly Grant (use Gerrit)
2016/12/21 22:25:15
Same comment as previous.
dougt
2016/12/22 01:18:03
Done.
|
| + |
| + auto characteristic = BluetoothRemoteGattCharacteristicAndroid::Create( |
| + adapter_, this, instance_id_string, bluetooth_gatt_characteristic_wrapper, |
| + chrome_bluetooth_device); |
| - characteristics_.set( |
| - instance_id_string, |
| - BluetoothRemoteGattCharacteristicAndroid::Create( |
| - adapter_, this, instance_id_string, |
| - bluetooth_gatt_characteristic_wrapper, chrome_bluetooth_device)); |
| + characteristics_.insert( |
| + std::make_pair(instance_id_string, std::move(characteristic))); |
| } |
| BluetoothRemoteGattServiceAndroid::BluetoothRemoteGattServiceAndroid( |