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

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

Issue 1944013003: Move ownership of source SiteInstance to the FrameNavigationEntry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another round of review comments addressed. Created 4 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 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/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 // with a subframe entry for our destination. 766 // with a subframe entry for our destination.
767 // TODO(creis): Ensure this case can't exist in https://crbug.com/524208. 767 // TODO(creis): Ensure this case can't exist in https://crbug.com/524208.
768 entry = NavigationEntryImpl::FromNavigationEntry( 768 entry = NavigationEntryImpl::FromNavigationEntry(
769 controller_->CreateNavigationEntry( 769 controller_->CreateNavigationEntry(
770 GURL(url::kAboutBlankURL), referrer_to_use, page_transition, 770 GURL(url::kAboutBlankURL), referrer_to_use, page_transition,
771 is_renderer_initiated, std::string(), 771 is_renderer_initiated, std::string(),
772 controller_->GetBrowserContext())); 772 controller_->GetBrowserContext()));
773 } 773 }
774 // TODO(creis): Handle POST submissions. See https://crbug.com/582211 and 774 // TODO(creis): Handle POST submissions. See https://crbug.com/582211 and
775 // https://crbug.com/101395. 775 // https://crbug.com/101395.
776 entry->AddOrUpdateFrameEntry(node, -1, -1, nullptr, dest_url, 776 entry->AddOrUpdateFrameEntry(
777 referrer_to_use, PageState(), "GET", -1); 777 node, -1, -1, nullptr,
778 static_cast<SiteInstanceImpl*>(source_site_instance), dest_url,
779 referrer_to_use, PageState(), "GET", -1);
778 } else { 780 } else {
779 // Main frame case. 781 // Main frame case.
780 entry = NavigationEntryImpl::FromNavigationEntry( 782 entry = NavigationEntryImpl::FromNavigationEntry(
781 controller_->CreateNavigationEntry( 783 controller_->CreateNavigationEntry(
782 dest_url, referrer_to_use, page_transition, is_renderer_initiated, 784 dest_url, referrer_to_use, page_transition, is_renderer_initiated,
783 std::string(), controller_->GetBrowserContext())); 785 std::string(), controller_->GetBrowserContext()));
786 entry->root_node()->frame_entry->set_source_site_instance(
787 static_cast<SiteInstanceImpl*>(source_site_instance));
784 } 788 }
785 789
786 // The source_site_instance may matter for navigations via RenderFrameProxy.
787 entry->set_source_site_instance(
788 static_cast<SiteInstanceImpl*>(source_site_instance));
789 entry->SetRedirectChain(redirect_chain); 790 entry->SetRedirectChain(redirect_chain);
790 // Don't allow an entry replacement if there is no entry to replace. 791 // Don't allow an entry replacement if there is no entry to replace.
791 // http://crbug.com/457149 792 // http://crbug.com/457149
792 if (should_replace_current_entry && controller_->GetEntryCount() > 0) 793 if (should_replace_current_entry && controller_->GetEntryCount() > 0)
793 entry->set_should_replace_entry(true); 794 entry->set_should_replace_entry(true);
794 if (controller_->GetLastCommittedEntry() && 795 if (controller_->GetLastCommittedEntry() &&
795 controller_->GetLastCommittedEntry()->GetIsOverridingUserAgent()) { 796 controller_->GetLastCommittedEntry()->GetIsOverridingUserAgent()) {
796 entry->SetIsOverridingUserAgent(true); 797 entry->SetIsOverridingUserAgent(true);
797 } 798 }
798 entry->set_transferred_global_request_id(transferred_global_request_id); 799 entry->set_transferred_global_request_id(transferred_global_request_id);
799 // TODO(creis): Set user gesture and intent received timestamp on Android. 800 // TODO(creis): Set user gesture and intent received timestamp on Android.
800 801
801 // We may not have successfully added the FrameNavigationEntry to |entry| 802 // We may not have successfully added the FrameNavigationEntry to |entry|
802 // above (per https://crbug.com/608402), in which case we create it from 803 // above (per https://crbug.com/608402), in which case we create it from
803 // scratch. This works because we do not depend on |frame_entry| being inside 804 // scratch. This works because we do not depend on |frame_entry| being inside
804 // |entry| during NavigateToEntry. This will go away when we shortcut this 805 // |entry| during NavigateToEntry. This will go away when we shortcut this
805 // further in https://crbug.com/536906. 806 // further in https://crbug.com/536906.
806 scoped_refptr<FrameNavigationEntry> frame_entry(entry->GetFrameEntry(node)); 807 scoped_refptr<FrameNavigationEntry> frame_entry(entry->GetFrameEntry(node));
807 if (!frame_entry) { 808 if (!frame_entry) {
808 // TODO(creis): Handle POST submissions here, as above. 809 // TODO(creis): Handle POST submissions here, as above.
809 frame_entry = 810 frame_entry = new FrameNavigationEntry(
810 new FrameNavigationEntry(node->unique_name(), -1, -1, nullptr, dest_url, 811 node->unique_name(), -1, -1, nullptr,
811 referrer_to_use, "GET", -1); 812 static_cast<SiteInstanceImpl*>(source_site_instance), dest_url,
813 referrer_to_use, "GET", -1);
812 } 814 }
813 NavigateToEntry(node, *frame_entry, *entry.get(), 815 NavigateToEntry(node, *frame_entry, *entry.get(),
814 NavigationController::NO_RELOAD, false, false); 816 NavigationController::NO_RELOAD, false, false);
815 } 817 }
816 818
817 // PlzNavigate 819 // PlzNavigate
818 void NavigatorImpl::OnBeforeUnloadACK(FrameTreeNode* frame_tree_node, 820 void NavigatorImpl::OnBeforeUnloadACK(FrameTreeNode* frame_tree_node,
819 bool proceed) { 821 bool proceed) {
820 CHECK(IsBrowserSideNavigationEnabled()); 822 CHECK(IsBrowserSideNavigationEnabled());
821 DCHECK(frame_tree_node); 823 DCHECK(frame_tree_node);
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 if (pending_entry != controller_->GetVisibleEntry() || 1147 if (pending_entry != controller_->GetVisibleEntry() ||
1146 !should_preserve_entry) { 1148 !should_preserve_entry) {
1147 controller_->DiscardPendingEntry(true); 1149 controller_->DiscardPendingEntry(true);
1148 1150
1149 // Also force the UI to refresh. 1151 // Also force the UI to refresh.
1150 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); 1152 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
1151 } 1153 }
1152 } 1154 }
1153 1155
1154 } // namespace content 1156 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_request.cc ('k') | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698