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

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

Issue 180993003: Revert "Revert 249676 "Have the unload event execute in background on cr..."" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delete RFH pending shutdown in all nodes of the FrameTree Created 6 years, 10 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 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 2095af811f6ffc66b66b550d091621306a6c8870..f51790888d2f89ba92129239f46199824ec6e233 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -327,6 +327,11 @@ WebContentsImpl::WebContentsImpl(
WebContentsImpl::~WebContentsImpl() {
is_being_destroyed_ = true;
+ // Delete all RFH pending shutdown, which will lead the corresponding RVH to
+ // shutdown and be deleted as well.
+ frame_tree_.ForEach(
+ base::Bind(&RenderFrameHostManager::ClearRFHsPendingShutdown));
+
ClearAllPowerSaveBlockers();
for (std::set<RenderWidgetHostImpl*>::iterator iter =
@@ -2779,7 +2784,7 @@ void WebContentsImpl::RenderViewCreated(RenderViewHost* render_view_host) {
// Don't send notifications if we are just creating a swapped-out RVH for
// the opener chain. These won't be used for view-source or WebUI, so it's
// ok to return early.
- if (static_cast<RenderViewHostImpl*>(render_view_host)->is_swapped_out())
+ if (static_cast<RenderViewHostImpl*>(render_view_host)->IsSwappedOut())
return;
if (delegate_)
@@ -3061,7 +3066,7 @@ void WebContentsImpl::RequestOpenURL(RenderViewHost* rvh,
bool user_gesture) {
// If this came from a swapped out RenderViewHost, we only allow the request
// if we are still in the same BrowsingInstance.
- if (static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out() &&
+ if (static_cast<RenderViewHostImpl*>(rvh)->IsSwappedOut() &&
!rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance())) {
return;
}
@@ -3232,7 +3237,7 @@ void WebContentsImpl::RunJavaScriptMessage(
// showing an interstitial as it's shown over the previous page and we don't
// want the hidden page's dialogs to interfere with the interstitial.
bool suppress_this_message =
- static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out() ||
+ static_cast<RenderViewHostImpl*>(rvh)->IsSwappedOut() ||
ShowingInterstitialPage() ||
!delegate_ ||
delegate_->ShouldSuppressDialogs() ||
@@ -3277,7 +3282,7 @@ void WebContentsImpl::RunBeforeUnloadConfirm(RenderViewHost* rvh,
delegate_->WillRunBeforeUnloadConfirm();
bool suppress_this_message =
- rvhi->is_swapped_out() ||
+ rvhi->rvh_state() != RenderViewHostImpl::STATE_DEFAULT ||
!delegate_ ||
delegate_->ShouldSuppressDialogs() ||
!delegate_->GetJavaScriptDialogManager();
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('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