perf: avoid a triple-redundant map lookup in ViewsDelegate::GetAppbarAutohideEdges()
(#46335)
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
b4fc140f1a
commit
cb7335b4f0
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
|
// 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
|
// we don't initially go fullscreen until we figure out the real auto-hide
|
||||||
// edges.
|
// edges.
|
||||||
if (!appbar_autohide_edge_map_.contains(monitor))
|
auto [iter, _] = appbar_autohide_edge_map_.try_emplace(monitor, EDGE_BOTTOM);
|
||||||
appbar_autohide_edge_map_[monitor] = EDGE_BOTTOM;
|
const int edges{iter->second};
|
||||||
|
|
||||||
// We use the SHAppBarMessage API to get the taskbar autohide state. This API
|
// 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
|
// 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(&GetAppbarAutohideEdgesOnWorkerThread, monitor),
|
||||||
base::BindOnce(&ViewsDelegate::OnGotAppbarAutohideEdges,
|
base::BindOnce(&ViewsDelegate::OnGotAppbarAutohideEdges,
|
||||||
weak_factory_.GetWeakPtr(), std::move(callback), monitor,
|
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,
|
void ViewsDelegate::OnGotAppbarAutohideEdges(base::OnceClosure callback,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue