| OLD | NEW |
| 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 2356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2367 // (if there was a cross-site "close" request pending when the user clicked | 2367 // (if there was a cross-site "close" request pending when the user clicked |
| 2368 // the close button). We want to keep the "for cross site" flag only if | 2368 // the close button). We want to keep the "for cross site" flag only if |
| 2369 // both the old and the new ones are also for cross site. | 2369 // both the old and the new ones are also for cross site. |
| 2370 unload_ack_is_for_navigation_ = | 2370 unload_ack_is_for_navigation_ = |
| 2371 unload_ack_is_for_navigation_ && for_navigation; | 2371 unload_ack_is_for_navigation_ && for_navigation; |
| 2372 } else { | 2372 } else { |
| 2373 // Start the hang monitor in case the renderer hangs in the beforeunload | 2373 // Start the hang monitor in case the renderer hangs in the beforeunload |
| 2374 // handler. | 2374 // handler. |
| 2375 is_waiting_for_beforeunload_ack_ = true; | 2375 is_waiting_for_beforeunload_ack_ = true; |
| 2376 unload_ack_is_for_navigation_ = for_navigation; | 2376 unload_ack_is_for_navigation_ = for_navigation; |
| 2377 // Increment the in-flight event count, to ensure that input events won't | 2377 if (render_view_host_->GetDelegate()->IsJavaScriptDialogShowing()) { |
| 2378 // cancel the timeout timer. | 2378 // If there is a JavaScript dialog up, don't bother sending the renderer |
| 2379 render_view_host_->GetWidget()->increment_in_flight_event_count(); | 2379 // the unload event because it is known unresponsive, waiting for the |
| 2380 render_view_host_->GetWidget()->StartHangMonitorTimeout( | 2380 // reply from the dialog. |
| 2381 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS), | 2381 SimulateBeforeUnloadAck(); |
| 2382 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_BEFORE_UNLOAD); | 2382 } else { |
| 2383 send_before_unload_start_time_ = base::TimeTicks::Now(); | 2383 // Increment the in-flight event count, to ensure that input events won't |
| 2384 Send(new FrameMsg_BeforeUnload(routing_id_, is_reload)); | 2384 // cancel the timeout timer. |
| 2385 render_view_host_->GetWidget()->increment_in_flight_event_count(); |
| 2386 render_view_host_->GetWidget()->StartHangMonitorTimeout( |
| 2387 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS), |
| 2388 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_BEFORE_UNLOAD); |
| 2389 send_before_unload_start_time_ = base::TimeTicks::Now(); |
| 2390 Send(new FrameMsg_BeforeUnload(routing_id_, is_reload)); |
| 2391 } |
| 2385 } | 2392 } |
| 2386 } | 2393 } |
| 2387 | 2394 |
| 2388 void RenderFrameHostImpl::SimulateBeforeUnloadAck() { | 2395 void RenderFrameHostImpl::SimulateBeforeUnloadAck() { |
| 2389 DCHECK(is_waiting_for_beforeunload_ack_); | 2396 DCHECK(is_waiting_for_beforeunload_ack_); |
| 2390 base::TimeTicks approx_renderer_start_time = send_before_unload_start_time_; | 2397 base::TimeTicks approx_renderer_start_time = send_before_unload_start_time_; |
| 2391 OnBeforeUnloadACK(true, approx_renderer_start_time, base::TimeTicks::Now()); | 2398 OnBeforeUnloadACK(true, approx_renderer_start_time, base::TimeTicks::Now()); |
| 2392 } | 2399 } |
| 2393 | 2400 |
| 2394 bool RenderFrameHostImpl::ShouldDispatchBeforeUnload() { | 2401 bool RenderFrameHostImpl::ShouldDispatchBeforeUnload() { |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3100 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3107 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
| 3101 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3108 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
| 3102 return web_bluetooth_service_.get(); | 3109 return web_bluetooth_service_.get(); |
| 3103 } | 3110 } |
| 3104 | 3111 |
| 3105 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3112 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
| 3106 web_bluetooth_service_.reset(); | 3113 web_bluetooth_service_.reset(); |
| 3107 } | 3114 } |
| 3108 | 3115 |
| 3109 } // namespace content | 3116 } // namespace content |
| OLD | NEW |