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

perf: avoid double map lookup in WebFrameMain constructor

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:
trop[bot] 2025-03-25 22:06:22 -04:00 committed by GitHub
parent 7a950f09ae
commit a3ba653bee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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 ||