diff --git a/shell/browser/ui/views/electron_views_delegate_win.cc b/shell/browser/ui/views/electron_views_delegate_win.cc index cb67cccd7c5c..a6bce43396ee 100644 --- a/shell/browser/ui/views/electron_views_delegate_win.cc +++ b/shell/browser/ui/views/electron_views_delegate_win.cc @@ -119,8 +119,8 @@ int ViewsDelegate::GetAppbarAutohideEdges(HMONITOR monitor, // in us thinking there is no auto-hide edges. By returning at least one edge // we don't initially go fullscreen until we figure out the real auto-hide // edges. - if (!appbar_autohide_edge_map_.contains(monitor)) - appbar_autohide_edge_map_[monitor] = EDGE_BOTTOM; + auto [iter, _] = appbar_autohide_edge_map_.try_emplace(monitor, EDGE_BOTTOM); + const int edges{iter->second}; // We use the SHAppBarMessage API to get the taskbar autohide state. This API // spins a modal loop which could cause callers to be reentered. To avoid @@ -133,9 +133,9 @@ int ViewsDelegate::GetAppbarAutohideEdges(HMONITOR monitor, base::BindOnce(&GetAppbarAutohideEdgesOnWorkerThread, monitor), base::BindOnce(&ViewsDelegate::OnGotAppbarAutohideEdges, weak_factory_.GetWeakPtr(), std::move(callback), monitor, - appbar_autohide_edge_map_[monitor])); + edges)); } - return appbar_autohide_edge_map_[monitor]; + return edges; } void ViewsDelegate::OnGotAppbarAutohideEdges(base::OnceClosure callback,