perf: avoid triple map lookup in ElectronHidDelegate::GetContextObserver()
(#46672)
perf: avoid triple map lookup in ElectronHidDelegate::GetContextObserver()
This commit is contained in:
parent
3a982ecad5
commit
297c4297b1
1 changed files with 4 additions and 5 deletions
|
@ -221,11 +221,10 @@ bool ElectronHidDelegate::IsServiceWorkerAllowedForOrigin(
|
|||
ElectronHidDelegate::ContextObservation*
|
||||
ElectronHidDelegate::GetContextObserver(
|
||||
content::BrowserContext* browser_context) {
|
||||
if (!observations_.contains(browser_context)) {
|
||||
observations_.emplace(browser_context, std::make_unique<ContextObservation>(
|
||||
this, browser_context));
|
||||
}
|
||||
return observations_[browser_context].get();
|
||||
auto& observation = observations_[browser_context];
|
||||
if (!observation)
|
||||
observation = std::make_unique<ContextObservation>(this, browser_context);
|
||||
return observation.get();
|
||||
}
|
||||
|
||||
HidChooserController* ElectronHidDelegate::ControllerForFrame(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue