perf: avoid a triple-redundant map lookup in ViewsDelegate::GetAppbarAutohideEdges()
(#46333)
perf: avoid a triple-redundant map lookup in ViewsDelegate::GetAppbarAutohideEdges() 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
dc4233fd40
commit
94926b734c
1 changed files with 4 additions and 4 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue