| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 FrameTreeNode* frame_tree_node, | 690 FrameTreeNode* frame_tree_node, |
| 691 int64_t item_sequence_number, | 691 int64_t item_sequence_number, |
| 692 int64_t document_sequence_number, | 692 int64_t document_sequence_number, |
| 693 SiteInstanceImpl* site_instance, | 693 SiteInstanceImpl* site_instance, |
| 694 scoped_refptr<SiteInstanceImpl> source_site_instance, | 694 scoped_refptr<SiteInstanceImpl> source_site_instance, |
| 695 const GURL& url, | 695 const GURL& url, |
| 696 const Referrer& referrer, | 696 const Referrer& referrer, |
| 697 const PageState& page_state, | 697 const PageState& page_state, |
| 698 const std::string& method, | 698 const std::string& method, |
| 699 int64_t post_id) { | 699 int64_t post_id) { |
| 700 // We should only have an empty PageState if the navigation is new, and thus |
| 701 // page ID is -1. |
| 702 if (!page_state.IsValid() && GetPageID() != -1) { |
| 703 // Temporarily generate a minidump to diagnose https://crbug.com/568703. |
| 704 base::debug::DumpWithoutCrashing(); |
| 705 NOTREACHED() << "Shouldn't set an empty PageState."; |
| 706 } |
| 707 |
| 708 // If this is called for the main frame, the FrameNavigationEntry is |
| 709 // guaranteed to exist, so just update it directly and return. |
| 710 if (frame_tree_node->IsMainFrame()) { |
| 711 // If the document of the FrameNavigationEntry is changing, we must clear |
| 712 // any child FrameNavigationEntries. |
| 713 if (root_node()->frame_entry->document_sequence_number() != |
| 714 document_sequence_number) |
| 715 root_node()->children.clear(); |
| 716 |
| 717 root_node()->frame_entry->UpdateEntry( |
| 718 frame_tree_node->unique_name(), item_sequence_number, |
| 719 document_sequence_number, site_instance, |
| 720 std::move(source_site_instance), url, referrer, page_state, method, |
| 721 post_id); |
| 722 return; |
| 723 } |
| 724 |
| 700 // We should already have a TreeNode for the parent node by the time this node | 725 // We should already have a TreeNode for the parent node by the time this node |
| 701 // commits. Find it first. | 726 // commits. Find it first. |
| 702 DCHECK(frame_tree_node->parent()); | |
| 703 NavigationEntryImpl::TreeNode* parent_node = | 727 NavigationEntryImpl::TreeNode* parent_node = |
| 704 FindFrameEntry(frame_tree_node->parent()); | 728 FindFrameEntry(frame_tree_node->parent()); |
| 705 if (!parent_node) { | 729 if (!parent_node) { |
| 706 // The renderer should not send a commit for a subframe before its parent. | 730 // The renderer should not send a commit for a subframe before its parent. |
| 707 // TODO(creis): Kill the renderer if we get here. | 731 // TODO(creis): Kill the renderer if we get here. |
| 708 return; | 732 return; |
| 709 } | 733 } |
| 710 | 734 |
| 711 // Now check whether we have a TreeNode for the node itself. | 735 // Now check whether we have a TreeNode for the node itself. |
| 712 const std::string& unique_name = frame_tree_node->unique_name(); | 736 const std::string& unique_name = frame_tree_node->unique_name(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 return node; | 786 return node; |
| 763 | 787 |
| 764 // Enqueue any children and keep looking. | 788 // Enqueue any children and keep looking. |
| 765 for (auto& child : node->children) | 789 for (auto& child : node->children) |
| 766 work_queue.push(child); | 790 work_queue.push(child); |
| 767 } | 791 } |
| 768 return nullptr; | 792 return nullptr; |
| 769 } | 793 } |
| 770 | 794 |
| 771 } // namespace content | 795 } // namespace content |
| OLD | NEW |