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

Side by Side 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: charlie's fixes 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 DidAttachInterstitialPage()); 1931 DidAttachInterstitialPage());
1932 } 1932 }
1933 1933
1934 void WebContentsImpl::DetachInterstitialPage() { 1934 void WebContentsImpl::DetachInterstitialPage() {
1935 if (ShowingInterstitialPage()) 1935 if (ShowingInterstitialPage())
1936 GetRenderManager()->remove_interstitial_page(); 1936 GetRenderManager()->remove_interstitial_page();
1937 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 1937 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
1938 DidDetachInterstitialPage()); 1938 DidDetachInterstitialPage());
1939 } 1939 }
1940 1940
1941 void WebContentsImpl::SetHistoryLengthAndPrune( 1941 void WebContentsImpl::SetHistoryOffsetAndLength(int history_offset,
1942 const SiteInstance* site_instance, 1942 int history_length) {
1943 int history_length, 1943 SetHistoryOffsetAndLengthForView(
1944 int32 minimum_page_id) { 1944 GetRenderViewHost(), history_offset, history_length);
1945 // SetHistoryLengthAndPrune doesn't work when there are pending cross-site 1945 }
1946 // navigations. Callers should ensure that this is the case. 1946
1947 if (GetRenderManager()->pending_render_view_host()) { 1947 void WebContentsImpl::SetHistoryOffsetAndLengthForView(
1948 NOTREACHED(); 1948 RenderViewHost* render_view_host,
1949 return; 1949 int history_offset,
1950 } 1950 int history_length) {
1951 RenderViewHostImpl* rvh = GetRenderViewHostImpl(); 1951 render_view_host->Send(new ViewMsg_SetHistoryOffsetAndLength(
1952 if (!rvh) { 1952 render_view_host->GetRoutingID(), history_offset, history_length));
1953 NOTREACHED();
1954 return;
1955 }
1956 if (site_instance && rvh->GetSiteInstance() != site_instance) {
1957 NOTREACHED();
1958 return;
1959 }
1960 Send(new ViewMsg_SetHistoryLengthAndPrune(GetRoutingID(),
1961 history_length,
1962 minimum_page_id));
1963 } 1953 }
1964 1954
1965 void WebContentsImpl::ReloadFocusedFrame(bool ignore_cache) { 1955 void WebContentsImpl::ReloadFocusedFrame(bool ignore_cache) {
1966 RenderFrameHost* focused_frame = GetFocusedFrame(); 1956 RenderFrameHost* focused_frame = GetFocusedFrame();
1967 if (!focused_frame) 1957 if (!focused_frame)
1968 return; 1958 return;
1969 1959
1970 focused_frame->Send(new FrameMsg_Reload( 1960 focused_frame->Send(new FrameMsg_Reload(
1971 focused_frame->GetRoutingID(), ignore_cache)); 1961 focused_frame->GetRoutingID(), ignore_cache));
1972 } 1962 }
(...skipping 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after
4136 4126
4137 if (!static_cast<RenderViewHostImpl*>( 4127 if (!static_cast<RenderViewHostImpl*>(
4138 render_view_host)->CreateRenderView(base::string16(), 4128 render_view_host)->CreateRenderView(base::string16(),
4139 opener_route_id, 4129 opener_route_id,
4140 proxy_routing_id, 4130 proxy_routing_id,
4141 max_page_id, 4131 max_page_id,
4142 created_with_opener_)) { 4132 created_with_opener_)) {
4143 return false; 4133 return false;
4144 } 4134 }
4145 4135
4136 SetHistoryOffsetAndLengthForView(render_view_host,
4137 controller_.GetLastCommittedEntryIndex(),
4138 controller_.GetEntryCount());
4139
4146 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 4140 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
4147 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on 4141 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on
4148 // linux. See crbug.com/83941. 4142 // linux. See crbug.com/83941.
4149 if (rwh_view) { 4143 if (rwh_view) {
4150 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) 4144 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost())
4151 render_widget_host->WasResized(); 4145 render_widget_host->WasResized();
4152 } 4146 }
4153 #endif 4147 #endif
4154 4148
4155 return true; 4149 return true;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
4356 node->render_manager()->ResumeResponseDeferredAtStart(); 4350 node->render_manager()->ResumeResponseDeferredAtStart();
4357 } 4351 }
4358 4352
4359 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4353 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4360 force_disable_overscroll_content_ = force_disable; 4354 force_disable_overscroll_content_ = force_disable;
4361 if (view_) 4355 if (view_)
4362 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4356 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4363 } 4357 }
4364 4358
4365 } // namespace content 4359 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698