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

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

Issue 1968933002: Fix: tabs slow to response to beforeunload are closed prematurely. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Correct order of checks Created 4 years, 7 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
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 #include "content/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 // Increment the in-flight event count, to ensure that input events won't 2117 // Increment the in-flight event count, to ensure that input events won't
2118 // cancel the timeout timer. 2118 // cancel the timeout timer.
2119 render_view_host_->GetWidget()->increment_in_flight_event_count(); 2119 render_view_host_->GetWidget()->increment_in_flight_event_count();
2120 render_view_host_->GetWidget()->StartHangMonitorTimeout( 2120 render_view_host_->GetWidget()->StartHangMonitorTimeout(
2121 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)); 2121 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS));
2122 send_before_unload_start_time_ = base::TimeTicks::Now(); 2122 send_before_unload_start_time_ = base::TimeTicks::Now();
2123 Send(new FrameMsg_BeforeUnload(routing_id_)); 2123 Send(new FrameMsg_BeforeUnload(routing_id_));
2124 } 2124 }
2125 } 2125 }
2126 2126
2127 void RenderFrameHostImpl::SimulateBeforeUnloadAck() {
2128 DCHECK(is_waiting_for_beforeunload_ack_);
2129 base::TimeTicks approx_renderer_start_time = send_before_unload_start_time_;
2130 OnBeforeUnloadACK(true, approx_renderer_start_time, base::TimeTicks::Now());
2131 }
2132
2127 bool RenderFrameHostImpl::ShouldDispatchBeforeUnload() { 2133 bool RenderFrameHostImpl::ShouldDispatchBeforeUnload() {
2128 // TODO(creis): Support beforeunload on subframes. 2134 // TODO(creis): Support beforeunload on subframes.
2129 return !GetParent() && IsRenderFrameLive(); 2135 return !GetParent() && IsRenderFrameLive();
2130 } 2136 }
2131 2137
2132 void RenderFrameHostImpl::UpdateOpener() { 2138 void RenderFrameHostImpl::UpdateOpener() {
2133 // This frame (the frame whose opener is being updated) might not have had 2139 // This frame (the frame whose opener is being updated) might not have had
2134 // proxies for the new opener chain in its SiteInstance. Make sure they 2140 // proxies for the new opener chain in its SiteInstance. Make sure they
2135 // exist. 2141 // exist.
2136 if (frame_tree_node_->opener()) { 2142 if (frame_tree_node_->opener()) {
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
2764 // handler after it's destroyed so it can't run after the RFHI is destroyed. 2770 // handler after it's destroyed so it can't run after the RFHI is destroyed.
2765 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( 2771 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind(
2766 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); 2772 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this)));
2767 } 2773 }
2768 2774
2769 void RenderFrameHostImpl::DeleteWebBluetoothService() { 2775 void RenderFrameHostImpl::DeleteWebBluetoothService() {
2770 web_bluetooth_service_.reset(); 2776 web_bluetooth_service_.reset();
2771 } 2777 }
2772 2778
2773 } // namespace content 2779 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698