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

Side by Side Diff: content/browser/frame_host/navigation_entry_impl.cc

Issue 1255573005: Create FrameNavigationEntries for the initial blank page in subframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests and move has_committed_real_load Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/navigation_entry_impl.h" 5 #include "content/browser/frame_host/navigation_entry_impl.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 // commits. Find it first. 538 // commits. Find it first.
539 DCHECK(frame_tree_node->parent()); 539 DCHECK(frame_tree_node->parent());
540 NavigationEntryImpl::TreeNode* parent_node = 540 NavigationEntryImpl::TreeNode* parent_node =
541 FindFrameEntry(frame_tree_node->parent()); 541 FindFrameEntry(frame_tree_node->parent());
542 if (!parent_node) { 542 if (!parent_node) {
543 // The renderer should not send a commit for a subframe before its parent. 543 // The renderer should not send a commit for a subframe before its parent.
544 // However, we may see commits of subframes when their parent or ancestor is 544 // However, we may see commits of subframes when their parent or ancestor is
545 // still the initial about:blank page, and we don't currently keep a 545 // still the initial about:blank page, and we don't currently keep a
546 // FrameNavigationEntry for that. We ignore such commits, similar to how we 546 // FrameNavigationEntry for that. We ignore such commits, similar to how we
547 // handle them at the top level. 547 // handle them at the top level.
548 // TODO(creis): Consider creating FNEs for initial about:blank commits. 548 NOTREACHED() << "Shouldn't see a commit for a subframe before parent.";
Charlie Reis 2015/07/23 19:57:34 This reverts https://crrev.com/334385. (I can put
Avi (use Gerrit) 2015/07/23 20:27:58 Acknowledged.
Charlie Reis 2015/07/23 22:02:22 Done.
549 return; 549 return;
550 } 550 }
551 551
552 // Now check whether we have a TreeNode for the node itself. 552 // Now check whether we have a TreeNode for the node itself.
553 int frame_tree_node_id = frame_tree_node->frame_tree_node_id(); 553 int frame_tree_node_id = frame_tree_node->frame_tree_node_id();
554 for (TreeNode* child : parent_node->children) { 554 for (TreeNode* child : parent_node->children) {
555 if (child->frame_entry->frame_tree_node_id() == frame_tree_node_id) { 555 if (child->frame_entry->frame_tree_node_id() == frame_tree_node_id) {
556 // Update the existing FrameNavigationEntry (e.g., for replaceState). 556 // Update the existing FrameNavigationEntry (e.g., for replaceState).
557 child->frame_entry->UpdateEntry(item_sequence_number, 557 child->frame_entry->UpdateEntry(item_sequence_number,
558 document_sequence_number, site_instance, 558 document_sequence_number, site_instance,
559 url, referrer, page_state); 559 url, referrer, page_state);
560 return; 560 return;
561 } 561 }
562 } 562 }
563 563
564 // No entry exists yet, so create a new one unless it's for about:blank. 564 // No entry exists yet, so create a new one.
565 // Unordered list, since we expect to look up entries by frame sequence number 565 // Unordered list, since we expect to look up entries by frame sequence number
566 // or unique name. 566 // or unique name.
567 if (url == GURL(url::kAboutBlankURL))
568 return;
569 FrameNavigationEntry* frame_entry = new FrameNavigationEntry( 567 FrameNavigationEntry* frame_entry = new FrameNavigationEntry(
570 frame_tree_node_id, item_sequence_number, document_sequence_number, 568 frame_tree_node_id, item_sequence_number, document_sequence_number,
571 site_instance, url, referrer); 569 site_instance, url, referrer);
572 frame_entry->set_page_state(page_state); 570 frame_entry->set_page_state(page_state);
573 parent_node->children.push_back( 571 parent_node->children.push_back(
574 new NavigationEntryImpl::TreeNode(frame_entry)); 572 new NavigationEntryImpl::TreeNode(frame_entry));
575 } 573 }
576 574
577 FrameNavigationEntry* NavigationEntryImpl::GetFrameEntry( 575 FrameNavigationEntry* NavigationEntryImpl::GetFrameEntry(
578 FrameTreeNode* frame_tree_node) const { 576 FrameTreeNode* frame_tree_node) const {
(...skipping 27 matching lines...) Expand all
606 return node; 604 return node;
607 } 605 }
608 // Enqueue any children and keep looking. 606 // Enqueue any children and keep looking.
609 for (auto& child : node->children) 607 for (auto& child : node->children)
610 work_queue.push(child); 608 work_queue.push(child);
611 } 609 }
612 return nullptr; 610 return nullptr;
613 } 611 }
614 612
615 } // namespace content 613 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698