Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Unified Diff: device/bluetooth/bluetooth_device_android.cc

Issue 2567903004: Replace ScopedVector/ScopedPtrHashMap with std::vector and std::unordered_map (Closed)
Patch Set: Replace ScopedVector/ScopedPtrHashMap with std::vector and std::unordered_map Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698