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

This commit is contained in:
Charles Kerr 2025-04-01 12:39:34 -05:00 committed by GitHub
parent 0492f0f745
commit 5499c800a7
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_)