Commit abf355c2 authored by creis's avatar creis Committed by Commit bot

Clarify comment on FrameTree::AddFrame.

This behavior was updated in https://crrev.com/299939, but the comment
didn't explain why the method might return null.

BUG=none
TEST=No behavior change.

Review URL: https://codereview.chromium.org/938073002

Cr-Commit-Position: refs/heads/master@{#317084}
parent f470789e
...@@ -150,6 +150,8 @@ RenderFrameHostImpl* FrameTree::AddFrame(FrameTreeNode* parent, ...@@ -150,6 +150,8 @@ RenderFrameHostImpl* FrameTree::AddFrame(FrameTreeNode* parent,
// it is in the same SiteInstance as the parent frame. Ensure that the process // it is in the same SiteInstance as the parent frame. Ensure that the process
// which requested a child frame to be added is the same as the process of the // which requested a child frame to be added is the same as the process of the
// parent node. // parent node.
// We return nullptr if this is not the case, which can happen in a race if an
// old RFH sends a CreateChildFrame message as we're swapping to a new RFH.
if (parent->current_frame_host()->GetProcess()->GetID() != process_id) if (parent->current_frame_host()->GetProcess()->GetID() != process_id)
return nullptr; return nullptr;
......
...@@ -70,6 +70,10 @@ class CONTENT_EXPORT FrameTree { ...@@ -70,6 +70,10 @@ class CONTENT_EXPORT FrameTree {
void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const; void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const;
// Frame tree manipulation routines. // Frame tree manipulation routines.
// |process_id| is required to disambiguate |new_routing_id|, and it must
// match the process of the |parent| node. Otherwise this method returns
// nullptr. Passing MSG_ROUTING_NONE for |new_routing_id| will allocate a new
// routing ID for the new frame.
RenderFrameHostImpl* AddFrame(FrameTreeNode* parent, RenderFrameHostImpl* AddFrame(FrameTreeNode* parent,
int process_id, int process_id,
int new_routing_id, int new_routing_id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment