Commit a2343dd0 authored by Johannes Henkel's avatar Johannes Henkel Committed by Commit Bot

[Devtools] Simplify GetFtnForNetworkRequest.

Please make sure I didn't simplify it too much. :-)
Also, please let me know what comment to put (if any)
for the second return. Thanks.

Change-Id: Iffa201442e99c1df4896fe4c168845df2bcb9bc1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1718781
Commit-Queue: Johannes Henkel <johannes@chromium.org>
Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681141}
parent add9b228
...@@ -55,22 +55,19 @@ FrameTreeNode* GetFtnForNetworkRequest(int process_id, int routing_id) { ...@@ -55,22 +55,19 @@ FrameTreeNode* GetFtnForNetworkRequest(int process_id, int routing_id) {
// Navigation requests start in the browser, before process_id is assigned, so // Navigation requests start in the browser, before process_id is assigned, so
// the id is set to 0. In these situations, the routing_id is the frame tree // the id is set to 0. In these situations, the routing_id is the frame tree
// node id, and can be used directly. // node id, and can be used directly.
int frame_tree_node_id = if (process_id == 0) {
process_id == 0 ? routing_id FrameTreeNode* ftn = FrameTreeNode::GloballyFindByID(routing_id);
: RenderFrameHost::GetFrameTreeNodeIdForRoutingId( if (ftn == nullptr)
process_id, routing_id); return nullptr;
FrameTreeNode* ftn = FrameTreeNode::GloballyFindByID(frame_tree_node_id); // If this is a navigation request (process_id == 0) of a child frame
// (ftn->parent()), then requestWillBeSent and responseReceived are
// If this is a navigation request (process_id == 0) of a child frame // delivered to the parent frame instead of the child because we don't know
// (ftn->parent()), then requestWillBeSent and responseReceived are delivered // if the child will become an OOPIF with a separate target yet or not. Do
// to the parent frame instead of the child because we don't know if the child // the same for requestWillBeSentExtraInfo and responseReceivedExtraInfo.
// will become an OOPIF with a separate target yet or not. Do the same for return ftn->parent() ? ftn->parent() : ftn;
// requestWillBeSentExtraInfo and responseReceivedExtraInfo.
if (ftn && process_id == 0 && ftn->parent()) {
ftn = ftn->parent();
} }
return FrameTreeNode::GloballyFindByID(
return ftn; RenderFrameHost::GetFrameTreeNodeIdForRoutingId(process_id, routing_id));
} }
} // namespace } // namespace
......
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