perf: avoid redundant map lookup in WebFrameMain constructor (#46238)

perf: avoid double map lookup in WebFrameMain constructor
This commit is contained in:
Charles Kerr
2025-03-25 16:53:24 -05:00
committed by GitHub
parent c8d3184a95
commit 6e44662f15

View File

@@ -155,8 +155,8 @@ WebFrameMain::WebFrameMain(content::RenderFrameHost* rfh)
if (!render_frame_detached_)
GetFrameTreeNodeIdMap().emplace(frame_tree_node_id_, this);
DCHECK(!GetFrameTokenMap().contains(frame_token_));
GetFrameTokenMap().emplace(frame_token_, this);
const auto [_, inserted] = GetFrameTokenMap().emplace(frame_token_, this);
DCHECK(inserted);
// WebFrameMain should only be created for active or unloading frames.
DCHECK(GetLifecycleState(rfh) == LifecycleState::kActive ||