Index: device/bluetooth/bluetooth_device_android.cc |
diff --git a/device/bluetooth/bluetooth_device_android.cc b/device/bluetooth/bluetooth_device_android.cc |
index ce76d20b169b8667980d7833366732b7a95be885..18a944db4e57dd38d9e92b4f49fd6a7dd514119b 100644 |
--- a/device/bluetooth/bluetooth_device_android.cc |
+++ b/device/bluetooth/bluetooth_device_android.cc |
@@ -246,17 +246,19 @@ void BluetoothDeviceAndroid::CreateGattRemoteService( |
std::string instance_id_string = |
base::android::ConvertJavaStringToUTF8(env, instance_id); |
- if (gatt_services_.contains(instance_id_string)) |
+ if (gatt_services_.find(instance_id_string) != gatt_services_.end()) |
Reilly Grant (use Gerrit)
2016/12/21 22:25:13
if (base::ContainsKey(gatt_services_, instance_id_
dougt
2016/12/22 01:18:02
Done.
|
return; |
- BluetoothDevice::GattServiceMap::iterator service_iterator = |
- gatt_services_.set( |
- instance_id_string, |
- BluetoothRemoteGattServiceAndroid::Create( |
- GetAndroidAdapter(), this, bluetooth_gatt_service_wrapper, |
- instance_id_string, j_device_)); |
+ auto service = BluetoothRemoteGattServiceAndroid::Create( |
+ GetAndroidAdapter(), this, bluetooth_gatt_service_wrapper, |
+ instance_id_string, j_device_); |
- adapter_->NotifyGattServiceAdded(service_iterator->second); |
+ auto insertion = gatt_services_.insert( |
+ std::make_pair(instance_id_string, std::move(service))); |
+ if (insertion.second == false) { |
Reilly Grant (use Gerrit)
2016/12/21 22:25:14
insertion.second will always be true because we ch
dougt
2016/12/22 01:18:02
Done.
|
+ return; |
+ } |
+ adapter_->NotifyGattServiceAdded(insertion.first->second.get()); |
} |
BluetoothDeviceAndroid::BluetoothDeviceAndroid(BluetoothAdapterAndroid* adapter) |