Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: content/browser/frame_host/navigation_entry_impl.cc

Issue 1157373002: Revert of Fix the commit type for out-of-process iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/navigation_entry_impl.cc
diff --git a/content/browser/frame_host/navigation_entry_impl.cc b/content/browser/frame_host/navigation_entry_impl.cc
index 7ba5cf307a643b7b3509c07bd024d2e66b72a867..27236064583c85b4d99c2629ca639b5e3920b47c 100644
--- a/content/browser/frame_host/navigation_entry_impl.cc
+++ b/content/browser/frame_host/navigation_entry_impl.cc
@@ -31,17 +31,6 @@
}
NavigationEntryImpl::TreeNode::~TreeNode() {
-}
-
-bool NavigationEntryImpl::TreeNode::MatchesFrame(
- FrameTreeNode* frame_tree_node) const {
- if (frame_tree_node->frame_tree_node_id() ==
- frame_entry->frame_tree_node_id())
- return true;
-
- // For now, we set the root FNE's FrameTreeNode ID to -1.
- return frame_tree_node->IsMainFrame() &&
- frame_entry->frame_tree_node_id() == -1;
}
NavigationEntryImpl::TreeNode* NavigationEntryImpl::TreeNode::Clone() const {
@@ -430,7 +419,6 @@
RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams(
base::TimeTicks navigation_start,
- bool has_committed_real_load,
bool intended_as_new_entry,
int pending_history_list_offset,
int current_history_list_offset,
@@ -456,9 +444,9 @@
return RequestNavigationParams(
GetIsOverridingUserAgent(), navigation_start, redirects,
GetCanLoadLocalResources(), base::Time::Now(), GetPageState(),
- GetPageID(), GetUniqueID(), has_committed_real_load,
- intended_as_new_entry, pending_offset_to_send, current_offset_to_send,
- current_length_to_send, should_clear_history_list());
+ GetPageID(), GetUniqueID(), intended_as_new_entry, pending_offset_to_send,
+ current_offset_to_send, current_length_to_send,
+ should_clear_history_list());
}
void NavigationEntryImpl::ResetForCommit() {
@@ -489,9 +477,27 @@
// We should already have a TreeNode for the parent node by the time this node
// commits. Find it first.
DCHECK(frame_tree_node->parent());
- NavigationEntryImpl::TreeNode* parent_node =
- FindFrameEntry(frame_tree_node->parent());
- if (!parent_node) {
+ int parent_ftn_id = frame_tree_node->parent()->frame_tree_node_id();
+ bool found = false;
+ NavigationEntryImpl::TreeNode* parent_node = nullptr;
+ std::queue<NavigationEntryImpl::TreeNode*> work_queue;
+ work_queue.push(root_node());
+ while (!found && !work_queue.empty()) {
+ parent_node = work_queue.front();
+ work_queue.pop();
+ // The root FNE will have an ID of -1, so check for that as well.
+ if (parent_node->frame_entry->frame_tree_node_id() == parent_ftn_id ||
+ (parent_node->frame_entry->frame_tree_node_id() == -1 &&
+ parent_node == root_node() &&
+ frame_tree_node->parent()->IsMainFrame())) {
+ found = true;
+ break;
+ }
+ // Enqueue any children and keep looking.
+ for (auto& child : parent_node->children)
+ work_queue.push(child);
+ }
+ if (!found) {
// The renderer should not send a commit for a subframe before its parent.
// TODO(creis): This can currently happen because we don't yet clone the
// FrameNavigationEntry tree on manual subframe navigations. Once that's
@@ -509,19 +515,12 @@
}
}
- // No entry exists yet, so create a new one unless it's for about:blank.
- // Unordered list, since we expect to look up entries by frame sequence number
- // or unique name.
- if (url == GURL(url::kAboutBlankURL))
- return;
+ // No entry exists yet, so create a new one. Unordered list, since we expect
+ // to look up entries by frame sequence number or unique name.
FrameNavigationEntry* frame_entry = new FrameNavigationEntry(
frame_tree_node_id, site_instance, url, referrer);
parent_node->children.push_back(
new NavigationEntryImpl::TreeNode(frame_entry));
-}
-
-bool NavigationEntryImpl::HasFrameEntry(FrameTreeNode* frame_tree_node) const {
- return FindFrameEntry(frame_tree_node) != nullptr;
}
void NavigationEntryImpl::SetScreenshotPNGData(
@@ -535,25 +534,4 @@
return GetBaseURLForDataURL().is_empty() ? GURL() : GetVirtualURL();
}
-NavigationEntryImpl::TreeNode* NavigationEntryImpl::FindFrameEntry(
- FrameTreeNode* frame_tree_node) const {
- NavigationEntryImpl::TreeNode* node = nullptr;
- std::queue<NavigationEntryImpl::TreeNode*> work_queue;
- work_queue.push(root_node());
- while (!work_queue.empty()) {
- node = work_queue.front();
- work_queue.pop();
- if (node->MatchesFrame(frame_tree_node)) {
- // Only the root TreeNode should have a FTN ID of -1.
- DCHECK_IMPLIES(node->frame_entry->frame_tree_node_id() == -1,
- node == root_node());
- return node;
- }
- // Enqueue any children and keep looking.
- for (auto& child : node->children)
- work_queue.push(child);
- }
- return nullptr;
-}
-
} // namespace content
« no previous file with comments | « content/browser/frame_host/navigation_entry_impl.h ('k') | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698