• jdoerrie's avatar
    Reland "[Bluetooth] Make BluetoothDevice::UUIDSet a base::flat_set" · 922ae26b
    jdoerrie authored
    This is a reland of 9a6c55fc
    
    In order to address the CFI failures [1,2] causing the revert of the
    initial CL, this change also de-virtualizes BluetoothUUID. BluetoothUUID
    has no subclasses and is meant to use as a value type, which is why a virtual
    destructor does not make sense.
    
    [1] https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Linux%20CFI/9368
    [2] https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Android%20CFI/2352
    
    Original change's description:
    > [Bluetooth] Make BluetoothDevice::UUIDSet a base::flat_set
    >
    > BluetoothDevice::DeviceUUIDs::UpdateDeviceUUIDs() makes use of
    > std::set_union in order to merge advertised uuids and service uuids.
    > However, std::set_union requires sorted ranges as input, which wasn't
    > necessarily guaranteed before this change. When using a
    > std::unordered_set the order of elements is not specified and
    > std::set_union is not guaranteed to work correctly. Using a
    > base::flat_set for UUIDSet instead fixes this issue. In order to prevent
    > future regressions this change also replaces the usage of std::set_union
    > with base::STLSetUnion performing an explicit IsSorted() check in Debug
    > builds.
    >
    > Bug: 821766, 870208
    > Change-Id: Id25711e6acf77ded9eebb6c80db5bcb2ed8a63e0
    > Reviewed-on: https://chromium-review.googlesource.com/1159374
    > Reviewed-by: Giovanni Ortuño Urquidi <ortuno@chromium.org>
    > Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#580198}
    
    TBR=ortuno@chromium.org
    
    Bug: 821766, 870208
    Change-Id: I3fc55939ff5b8b136db0d45978c5b19083adb1d9
    Reviewed-on: https://chromium-review.googlesource.com/1161883Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
    Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#580530}
    922ae26b
bluetooth_device.h 31.2 KB