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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 743803002: Avoid stale navigation requests without excessive page id knowledge in the renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 6 years 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/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 9614814d1a2232c9a4de57e2ea6bc8ddf9385c15..ca9112af81bc56e40d79e9f6ff6dc120c11d0977 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1943,28 +1943,18 @@ void WebContentsImpl::DetachInterstitialPage() {
DidDetachInterstitialPage());
}
-void WebContentsImpl::SetHistoryLengthAndPrune(
- const SiteInstance* site_instance,
- int history_length,
- int32 minimum_page_id) {
- // SetHistoryLengthAndPrune doesn't work when there are pending cross-site
- // navigations. Callers should ensure that this is the case.
- if (GetRenderManager()->pending_render_view_host()) {
- NOTREACHED();
- return;
- }
- RenderViewHostImpl* rvh = GetRenderViewHostImpl();
- if (!rvh) {
- NOTREACHED();
- return;
- }
- if (site_instance && rvh->GetSiteInstance() != site_instance) {
- NOTREACHED();
- return;
- }
- Send(new ViewMsg_SetHistoryLengthAndPrune(GetRoutingID(),
- history_length,
- minimum_page_id));
+void WebContentsImpl::SetHistoryOffsetAndLength(int history_offset,
+ int history_length) {
+ SetHistoryOffsetAndLengthForView(
+ GetRenderViewHost(), history_offset, history_length);
+}
+
+void WebContentsImpl::SetHistoryOffsetAndLengthForView(
+ RenderViewHost* render_view_host,
+ int history_offset,
+ int history_length) {
+ render_view_host->Send(new ViewMsg_SetHistoryOffsetAndLength(
+ render_view_host->GetRoutingID(), history_offset, history_length));
}
void WebContentsImpl::ReloadFocusedFrame(bool ignore_cache) {
@@ -4148,6 +4138,10 @@ bool WebContentsImpl::CreateRenderViewForRenderManager(
return false;
}
+ SetHistoryOffsetAndLengthForView(render_view_host,
+ controller_.GetLastCommittedEntryIndex(),
+ controller_.GetEntryCount());
+
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
// Force a ViewMsg_Resize to be sent, needed to make plugins show up on
// linux. See crbug.com/83941.
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/browser/web_contents/web_contents_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698