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::ContextObservation*
|
||||||
ElectronHidDelegate::GetContextObserver(
|
ElectronHidDelegate::GetContextObserver(
|
||||||
content::BrowserContext* browser_context) {
|
content::BrowserContext* browser_context) {
|
||||||
if (!observations_.contains(browser_context)) {
|
auto& observation = observations_[browser_context];
|
||||||
observations_.emplace(browser_context, std::make_unique<ContextObservation>(
|
if (!observation)
|
||||||
this, browser_context));
|
observation = std::make_unique<ContextObservation>(this, browser_context);
|
||||||
}
|
return observation.get();
|
||||||
return observations_[browser_context].get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HidChooserController* ElectronHidDelegate::ControllerForFrame(
|
HidChooserController* ElectronHidDelegate::ControllerForFrame(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue