Chromium Code Reviews| Index: device/bluetooth/bluetooth_device_win.cc |
| diff --git a/device/bluetooth/bluetooth_device_win.cc b/device/bluetooth/bluetooth_device_win.cc |
| index 9436651ccbc9a86a86a5a290ae35dc6b5f206f07..69868ecf0205bf553c402bf054951b63ddc29b29 100644 |
| --- a/device/bluetooth/bluetooth_device_win.cc |
| +++ b/device/bluetooth/bluetooth_device_win.cc |
| @@ -112,7 +112,7 @@ bool BluetoothDeviceWin::IsConnecting() const { |
| return false; |
| } |
| -BluetoothDevice::UUIDList BluetoothDeviceWin::GetUUIDs() const { |
| +BluetoothDevice::UUIDSet BluetoothDeviceWin::GetUUIDs() const { |
| return uuids_; |
| } |
| @@ -233,16 +233,11 @@ bool BluetoothDeviceWin::IsEqual( |
| } |
| // Checks service collection |
| - typedef std::set<BluetoothUUID> UUIDSet; |
| typedef base::ScopedPtrHashMap<std::string, |
| std::unique_ptr<BluetoothServiceRecordWin>> |
| ServiceRecordMap; |
| - UUIDSet known_services; |
| - for (UUIDList::const_iterator iter = uuids_.begin(); iter != uuids_.end(); |
| - ++iter) { |
| - known_services.insert((*iter)); |
| - } |
| + UUIDSet known_services = uuids_; |
|
Jeffrey Yasskin
2016/08/19 15:09:53
Try not to make a copy here, if uuids_ doesn't cha
ortuno
2016/08/19 20:50:33
Done.
|
| UUIDSet new_services; |
| ServiceRecordMap new_service_records; |
| @@ -257,14 +252,8 @@ bool BluetoothDeviceWin::IsEqual( |
| std::unique_ptr<BluetoothServiceRecordWin>(service_record)); |
| } |
| - UUIDSet removed_services = |
| - base::STLSetDifference<UUIDSet>(known_services, new_services); |
| - if (!removed_services.empty()) { |
| - return false; |
| - } |
| - UUIDSet added_devices = |
| - base::STLSetDifference<UUIDSet>(new_services, known_services); |
| - if (!added_devices.empty()) { |
| + // Check that no new services have been added or removed. |
| + if (known_services != new_services) { |
| return false; |
| } |
| @@ -320,7 +309,7 @@ void BluetoothDeviceWin::UpdateServices( |
| new BluetoothServiceRecordWin(device_state.address, (*iter)->name, |
| (*iter)->sdp_bytes, (*iter)->gatt_uuid); |
| service_record_list_.push_back(service_record); |
| - uuids_.push_back(service_record->uuid()); |
| + uuids_.insert(service_record->uuid()); |
| } |
| if (!device_state.is_bluetooth_classic()) |