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

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

Issue 1303333006: Don't crash for subframes after in-page navigations in --site-per-process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /* 5 /*
6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 // All committed entries should have nonempty content state so WebKit doesn't 894 // All committed entries should have nonempty content state so WebKit doesn't
895 // get confused when we go back to them (see the function for details). 895 // get confused when we go back to them (see the function for details).
896 DCHECK(params.page_state.IsValid()); 896 DCHECK(params.page_state.IsValid());
897 NavigationEntryImpl* active_entry = GetLastCommittedEntry(); 897 NavigationEntryImpl* active_entry = GetLastCommittedEntry();
898 active_entry->SetTimestamp(timestamp); 898 active_entry->SetTimestamp(timestamp);
899 active_entry->SetHttpStatusCode(params.http_status_code); 899 active_entry->SetHttpStatusCode(params.http_status_code);
900 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { 900 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
901 // Update the frame-specific PageState. 901 // Update the frame-specific PageState.
902 FrameNavigationEntry* frame_entry = 902 FrameNavigationEntry* frame_entry =
903 active_entry->GetFrameEntry(rfh->frame_tree_node()); 903 active_entry->GetFrameEntry(rfh->frame_tree_node());
904 frame_entry->set_page_state(params.page_state); 904 // We may not find a frame_entry in some cases; ignore the PageState if so.
905 // TODO(creis): Remove the "if" once https://crbug.com/522193 is fixed.
906 if (frame_entry)
907 frame_entry->set_page_state(params.page_state);
905 } else { 908 } else {
906 active_entry->SetPageState(params.page_state); 909 active_entry->SetPageState(params.page_state);
907 } 910 }
908 active_entry->SetRedirectChain(params.redirects); 911 active_entry->SetRedirectChain(params.redirects);
909 912
910 // Use histogram to track memory impact of redirect chain because it's now 913 // Use histogram to track memory impact of redirect chain because it's now
911 // not cleared for committed entries. 914 // not cleared for committed entries.
912 size_t redirect_chain_size = 0; 915 size_t redirect_chain_size = 0;
913 for (size_t i = 0; i < params.redirects.size(); ++i) { 916 for (size_t i = 0; i < params.redirects.size(); ++i) {
914 redirect_chain_size += params.redirects[i].spec().length(); 917 redirect_chain_size += params.redirects[i].spec().length();
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 1239
1237 scoped_ptr<NavigationEntryImpl> new_entry; 1240 scoped_ptr<NavigationEntryImpl> new_entry;
1238 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { 1241 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
1239 // Make sure new_entry takes ownership of frame_entry in a scoped_refptr. 1242 // Make sure new_entry takes ownership of frame_entry in a scoped_refptr.
1240 FrameNavigationEntry* frame_entry = new FrameNavigationEntry( 1243 FrameNavigationEntry* frame_entry = new FrameNavigationEntry(
1241 rfh->frame_tree_node()->frame_tree_node_id(), 1244 rfh->frame_tree_node()->frame_tree_node_id(),
1242 params.item_sequence_number, params.document_sequence_number, 1245 params.item_sequence_number, params.document_sequence_number,
1243 rfh->GetSiteInstance(), params.url, params.referrer); 1246 rfh->GetSiteInstance(), params.url, params.referrer);
1244 new_entry = GetLastCommittedEntry()->CloneAndReplace(rfh->frame_tree_node(), 1247 new_entry = GetLastCommittedEntry()->CloneAndReplace(rfh->frame_tree_node(),
1245 frame_entry); 1248 frame_entry);
1246 CHECK(frame_entry->HasOneRef()); 1249
1250 // TODO(creis): Make sure the last committed entry always has the subframe
1251 // entry to replace, and CHECK(frame_entry->HasOneRef). For now, we might
1252 // not find the entry to replace, and new_entry will be deleted when it goes
1253 // out of scope. See https://crbug.com/522193.
1247 } else { 1254 } else {
1248 new_entry = GetLastCommittedEntry()->Clone(); 1255 new_entry = GetLastCommittedEntry()->Clone();
1249 } 1256 }
1250 1257
1251 new_entry->SetPageID(params.page_id); 1258 new_entry->SetPageID(params.page_id);
1252 InsertOrReplaceEntry(new_entry.Pass(), false); 1259 InsertOrReplaceEntry(new_entry.Pass(), false);
1253 } 1260 }
1254 1261
1255 bool NavigationControllerImpl::RendererDidNavigateAutoSubframe( 1262 bool NavigationControllerImpl::RendererDidNavigateAutoSubframe(
1256 RenderFrameHostImpl* rfh, 1263 RenderFrameHostImpl* rfh,
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 } 1991 }
1985 } 1992 }
1986 } 1993 }
1987 1994
1988 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 1995 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
1989 const base::Callback<base::Time()>& get_timestamp_callback) { 1996 const base::Callback<base::Time()>& get_timestamp_callback) {
1990 get_timestamp_callback_ = get_timestamp_callback; 1997 get_timestamp_callback_ = get_timestamp_callback;
1991 } 1998 }
1992 1999
1993 } // namespace content 2000 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698