perf: avoid triple map lookup in ElectronHidDelegate::GetContextObserver()
(#46687)
perf: avoid triple map lookup in ElectronHidDelegate::GetContextObserver() 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
e8188ef271
commit
3348ac08b4
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