| 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 b6ff8109294e6b8da9454c4cee3f9241cf83a6e8..ac933cec3f0fc3d7f2f955870c58644069cbc6df 100644
|
| --- a/content/browser/web_contents/web_contents_impl.cc
|
| +++ b/content/browser/web_contents/web_contents_impl.cc
|
| @@ -894,14 +894,15 @@ void WebContentsImpl::CopyMaxPageIDsFrom(WebContents* web_contents) {
|
| max_page_ids_ = contents->max_page_ids_;
|
| }
|
|
|
| -SiteInstance* WebContentsImpl::GetSiteInstance() const {
|
| +SiteInstanceImpl* WebContentsImpl::GetSiteInstance() const {
|
| return GetRenderManager()->current_host()->GetSiteInstance();
|
| }
|
|
|
| -SiteInstance* WebContentsImpl::GetPendingSiteInstance() const {
|
| - RenderViewHost* dest_rvh = GetRenderManager()->pending_render_view_host() ?
|
| - GetRenderManager()->pending_render_view_host() :
|
| - GetRenderManager()->current_host();
|
| +SiteInstanceImpl* WebContentsImpl::GetPendingSiteInstance() const {
|
| + RenderViewHostImpl* dest_rvh =
|
| + GetRenderManager()->pending_render_view_host() ?
|
| + GetRenderManager()->pending_render_view_host() :
|
| + GetRenderManager()->current_host();
|
| return dest_rvh->GetSiteInstance();
|
| }
|
|
|
| @@ -3413,8 +3414,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*>(render_frame_host->GetRenderViewHost())->
|
| - IsSwappedOut() ||
|
| + static_cast<RenderFrameHostImpl*>(render_frame_host)->is_swapped_out() ||
|
| ShowingInterstitialPage() ||
|
| !delegate_ ||
|
| delegate_->ShouldSuppressDialogs() ||
|
| @@ -3459,13 +3459,11 @@ void WebContentsImpl::RunBeforeUnloadConfirm(
|
| IPC::Message* reply_msg) {
|
| RenderFrameHostImpl* rfhi =
|
| static_cast<RenderFrameHostImpl*>(render_frame_host);
|
| - RenderViewHostImpl* rvhi =
|
| - static_cast<RenderViewHostImpl*>(render_frame_host->GetRenderViewHost());
|
| if (delegate_)
|
| delegate_->WillRunBeforeUnloadConfirm();
|
|
|
| bool suppress_this_message =
|
| - rvhi->rvh_state() != RenderViewHostImpl::STATE_DEFAULT ||
|
| + rfhi->rfh_state() != RenderFrameHostImpl::STATE_DEFAULT ||
|
| !delegate_ ||
|
| delegate_->ShouldSuppressDialogs() ||
|
| !delegate_->GetJavaScriptDialogManager();
|
| @@ -3524,7 +3522,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)->IsSwappedOut())
|
| + if (!static_cast<RenderViewHostImpl*>(render_view_host)->is_active())
|
| return;
|
|
|
| if (delegate_)
|
| @@ -3943,14 +3941,14 @@ void WebContentsImpl::OnIgnoredUIEvent() {
|
| FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetIgnoredUIEvent());
|
| }
|
|
|
| -void WebContentsImpl::RendererUnresponsive(RenderViewHost* rvh,
|
| - bool is_during_beforeunload,
|
| - bool is_during_unload) {
|
| +void WebContentsImpl::RendererUnresponsive(RenderViewHost* render_view_host) {
|
| // Don't show hung renderer dialog for a swapped out RVH.
|
| - if (rvh != GetRenderViewHost())
|
| + if (render_view_host != GetRenderViewHost())
|
| return;
|
|
|
| - RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(rvh);
|
| + RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(render_view_host);
|
| + RenderFrameHostImpl* rfhi =
|
| + static_cast<RenderFrameHostImpl*>(rvhi->GetMainFrame());
|
|
|
| // Ignore renderer unresponsive event if debugger is attached to the tab
|
| // since the event may be a result of the renderer sitting on a breakpoint.
|
| @@ -3958,7 +3956,8 @@ void WebContentsImpl::RendererUnresponsive(RenderViewHost* rvh,
|
| if (DevToolsAgentHost::IsDebuggerAttached(this))
|
| return;
|
|
|
| - if (is_during_beforeunload || is_during_unload) {
|
| + if (rfhi->is_waiting_for_beforeunload_ack() ||
|
| + rfhi->IsWaitingForUnloadACK()) {
|
| // Hang occurred while firing the beforeunload/unload handler.
|
| // Pretend the handler fired so tab closing continues as if it had.
|
| rvhi->set_sudden_termination_allowed(true);
|
| @@ -3973,11 +3972,11 @@ void WebContentsImpl::RendererUnresponsive(RenderViewHost* rvh,
|
| // close. Otherwise, pretend the unload listeners have all fired and close
|
| // the tab.
|
| bool close = true;
|
| - if (is_during_beforeunload && delegate_) {
|
| + if (rfhi->is_waiting_for_beforeunload_ack() && delegate_) {
|
| delegate_->BeforeUnloadFired(this, true, &close);
|
| }
|
| if (close)
|
| - Close(rvh);
|
| + Close(rvhi);
|
| return;
|
| }
|
|
|
|
|