perf: avoid redundant map lookup in HidChooserContext::DeviceChanged() (#46479)
		
	perf: avoid redundant map lookup in HidChooserContext::DeviceChanged() 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:
		
					parent
					
						
							
								0cb42911ea
							
						
					
				
			
			
				commit
				
					
						e0a24f08a1
					
				
			
		
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -274,10 +274,11 @@ void HidChooserContext::DeviceRemoved(device::mojom::HidDeviceInfoPtr device) {
 | 
			
		|||
 | 
			
		||||
void HidChooserContext::DeviceChanged(device::mojom::HidDeviceInfoPtr device) {
 | 
			
		||||
  DCHECK(device);
 | 
			
		||||
  DCHECK(devices_.contains(device->guid));
 | 
			
		||||
 | 
			
		||||
  // Update the device list.
 | 
			
		||||
  devices_[device->guid] = device->Clone();
 | 
			
		||||
  auto& mapped = devices_[device->guid];
 | 
			
		||||
  DCHECK(!mapped.is_null());
 | 
			
		||||
  mapped = device->Clone();
 | 
			
		||||
 | 
			
		||||
  // Notify all observers.
 | 
			
		||||
  for (auto& observer : device_observer_list_)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue