perf: avoid redundant map lookup in UsbChooserContext::OnDeviceRemoved() (#46418)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2025-04-01 20:53:43 -05:00 committed by GitHub
parent 92b03cb91f
commit 7299dd1501
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -302,8 +302,8 @@ void UsbChooserContext::OnDeviceRemoved(
}
// Update the device list.
DCHECK(devices_.contains(device_info->guid));
devices_.erase(device_info->guid);
const size_t n_erased = devices_.erase(device_info->guid);
DCHECK_EQ(n_erased, 1U);
// Notify all device observers.
for (auto& observer : device_observer_list_)