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

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

Issue 2136173003: Add an histogram to differentiate between hang types of the renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 unload_ack_is_for_navigation_ && for_navigation; 2243 unload_ack_is_for_navigation_ && for_navigation;
2244 } else { 2244 } else {
2245 // Start the hang monitor in case the renderer hangs in the beforeunload 2245 // Start the hang monitor in case the renderer hangs in the beforeunload
2246 // handler. 2246 // handler.
2247 is_waiting_for_beforeunload_ack_ = true; 2247 is_waiting_for_beforeunload_ack_ = true;
2248 unload_ack_is_for_navigation_ = for_navigation; 2248 unload_ack_is_for_navigation_ = for_navigation;
2249 // Increment the in-flight event count, to ensure that input events won't 2249 // Increment the in-flight event count, to ensure that input events won't
2250 // cancel the timeout timer. 2250 // cancel the timeout timer.
2251 render_view_host_->GetWidget()->increment_in_flight_event_count(); 2251 render_view_host_->GetWidget()->increment_in_flight_event_count();
2252 render_view_host_->GetWidget()->StartHangMonitorTimeout( 2252 render_view_host_->GetWidget()->StartHangMonitorTimeout(
2253 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)); 2253 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS),
2254 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_BEFORE_UNLOAD);
2254 send_before_unload_start_time_ = base::TimeTicks::Now(); 2255 send_before_unload_start_time_ = base::TimeTicks::Now();
2255 Send(new FrameMsg_BeforeUnload(routing_id_, is_reload)); 2256 Send(new FrameMsg_BeforeUnload(routing_id_, is_reload));
2256 } 2257 }
2257 } 2258 }
2258 2259
2259 void RenderFrameHostImpl::SimulateBeforeUnloadAck() { 2260 void RenderFrameHostImpl::SimulateBeforeUnloadAck() {
2260 DCHECK(is_waiting_for_beforeunload_ack_); 2261 DCHECK(is_waiting_for_beforeunload_ack_);
2261 base::TimeTicks approx_renderer_start_time = send_before_unload_start_time_; 2262 base::TimeTicks approx_renderer_start_time = send_before_unload_start_time_;
2262 OnBeforeUnloadACK(true, approx_renderer_start_time, base::TimeTicks::Now()); 2263 OnBeforeUnloadACK(true, approx_renderer_start_time, base::TimeTicks::Now());
2263 } 2264 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2296 const base::string16& user_input, 2297 const base::string16& user_input,
2297 bool dialog_was_suppressed) { 2298 bool dialog_was_suppressed) {
2298 GetProcess()->SetIgnoreInputEvents(false); 2299 GetProcess()->SetIgnoreInputEvents(false);
2299 bool is_waiting = is_waiting_for_beforeunload_ack_ || IsWaitingForUnloadACK(); 2300 bool is_waiting = is_waiting_for_beforeunload_ack_ || IsWaitingForUnloadACK();
2300 2301
2301 // If we are executing as part of (before)unload event handling, we don't 2302 // If we are executing as part of (before)unload event handling, we don't
2302 // want to use the regular hung_renderer_delay_ms_ if the user has agreed to 2303 // want to use the regular hung_renderer_delay_ms_ if the user has agreed to
2303 // leave the current page. In this case, use the regular timeout value used 2304 // leave the current page. In this case, use the regular timeout value used
2304 // during the (before)unload handling. 2305 // during the (before)unload handling.
2305 if (is_waiting) { 2306 if (is_waiting) {
2307 RenderWidgetHostDelegate::RendererUnresponsiveType type =
2308 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_DIALOG_CLOSED;
2309 if (success) {
2310 type = is_waiting_for_beforeunload_ack_
2311 ? RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_BEFORE_UNLOAD
2312 : RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_UNLOAD;
2313 }
2306 render_view_host_->GetWidget()->StartHangMonitorTimeout( 2314 render_view_host_->GetWidget()->StartHangMonitorTimeout(
2307 success 2315 success
2308 ? TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS) 2316 ? TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)
2309 : render_view_host_->GetWidget()->hung_renderer_delay()); 2317 : render_view_host_->GetWidget()->hung_renderer_delay(),
2318 type);
2310 } 2319 }
2311 2320
2312 FrameHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, 2321 FrameHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg,
2313 success, user_input); 2322 success, user_input);
2314 Send(reply_msg); 2323 Send(reply_msg);
2315 2324
2316 // If we are waiting for an unload or beforeunload ack and the user has 2325 // If we are waiting for an unload or beforeunload ack and the user has
2317 // suppressed messages, kill the tab immediately; a page that's spamming 2326 // suppressed messages, kill the tab immediately; a page that's spamming
2318 // alerts in onbeforeunload is presumably malicious, so there's no point in 2327 // alerts in onbeforeunload is presumably malicious, so there's no point in
2319 // continuing to run its script and dragging out the process. 2328 // continuing to run its script and dragging out the process.
2320 // This must be done after sending the reply since RenderView can't close 2329 // This must be done after sending the reply since RenderView can't close
2321 // correctly while waiting for a response. 2330 // correctly while waiting for a response.
2322 if (is_waiting && dialog_was_suppressed) { 2331 if (is_waiting && dialog_was_suppressed) {
2323 render_view_host_->GetWidget()->delegate()->RendererUnresponsive( 2332 render_view_host_->GetWidget()->delegate()->RendererUnresponsive(
2324 render_view_host_->GetWidget()); 2333 render_view_host_->GetWidget(),
2334 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_DIALOG_SUPPRESSED);
2325 } 2335 }
2326 } 2336 }
2327 2337
2328 // PlzNavigate 2338 // PlzNavigate
2329 void RenderFrameHostImpl::CommitNavigation( 2339 void RenderFrameHostImpl::CommitNavigation(
2330 ResourceResponse* response, 2340 ResourceResponse* response,
2331 std::unique_ptr<StreamHandle> body, 2341 std::unique_ptr<StreamHandle> body,
2332 const CommonNavigationParams& common_params, 2342 const CommonNavigationParams& common_params,
2333 const RequestNavigationParams& request_params, 2343 const RequestNavigationParams& request_params,
2334 bool is_view_source) { 2344 bool is_view_source) {
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
2958 // handler after it's destroyed so it can't run after the RFHI is destroyed. 2968 // handler after it's destroyed so it can't run after the RFHI is destroyed.
2959 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( 2969 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind(
2960 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); 2970 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this)));
2961 } 2971 }
2962 2972
2963 void RenderFrameHostImpl::DeleteWebBluetoothService() { 2973 void RenderFrameHostImpl::DeleteWebBluetoothService() {
2964 web_bluetooth_service_.reset(); 2974 web_bluetooth_service_.reset();
2965 } 2975 }
2966 2976
2967 } // namespace content 2977 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698