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

Unified Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_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_remote_gatt_characteristic_android.cc
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc
index d40c0066584448ba65a61e67aab176efba12cb88..63140c8fde134139226322406bbbfaf6c1414592 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc
@@ -113,7 +113,7 @@ BluetoothRemoteGattCharacteristicAndroid::GetDescriptors() const {
EnsureDescriptorsCreated();
std::vector<BluetoothRemoteGattDescriptor*> descriptors;
for (const auto& map_iter : descriptors_)
- descriptors.push_back(map_iter.second);
+ descriptors.push_back(map_iter.second.get());
return descriptors;
}
@@ -124,7 +124,7 @@ BluetoothRemoteGattCharacteristicAndroid::GetDescriptor(
const auto& iter = descriptors_.find(identifier);
if (iter == descriptors_.end())
return nullptr;
- return iter->second;
+ return iter->second.get();
}
void BluetoothRemoteGattCharacteristicAndroid::ReadRemoteCharacteristic(
@@ -241,12 +241,13 @@ void BluetoothRemoteGattCharacteristicAndroid::CreateGattRemoteDescriptor(
std::string instanceIdString =
base::android::ConvertJavaStringToUTF8(env, instanceId);
- DCHECK(!descriptors_.contains(instanceIdString));
+ auto dup = descriptors_.find(instanceIdString);
+ CHECK(!dup.second)
Reilly Grant (use Gerrit) 2016/12/21 22:25:14 DCHECK(!base::ContainsKey(descriptors_, instanceId
dougt 2016/12/22 01:18:03 Done.
+ auto descriptor = BluetoothRemoteGattDescriptorAndroid::Create(
+ instanceIdString, bluetooth_gatt_descriptor_wrapper,
+ chrome_bluetooth_device);
- descriptors_.set(instanceIdString,
- BluetoothRemoteGattDescriptorAndroid::Create(
- instanceIdString, bluetooth_gatt_descriptor_wrapper,
- chrome_bluetooth_device));
+ descriptors_.insert(std::make_pair(instanceIdString, std::move(descriptor)));
}
void BluetoothRemoteGattCharacteristicAndroid::SubscribeToNotifications(

Powered by Google App Engine
This is Rietveld 408576698