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

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

Issue 2737553003: Remove ChildProcess.HangRendererType. (Closed)
Patch Set: rebase on new version Created 3 years, 9 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 <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 2530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2541 // Start the hang monitor in case the renderer hangs in the beforeunload 2541 // Start the hang monitor in case the renderer hangs in the beforeunload
2542 // handler. 2542 // handler.
2543 is_waiting_for_beforeunload_ack_ = true; 2543 is_waiting_for_beforeunload_ack_ = true;
2544 unload_ack_is_for_navigation_ = for_navigation; 2544 unload_ack_is_for_navigation_ = for_navigation;
2545 if (render_view_host_->GetDelegate()->IsJavaScriptDialogShowing()) { 2545 if (render_view_host_->GetDelegate()->IsJavaScriptDialogShowing()) {
2546 // If there is a JavaScript dialog up, don't bother sending the renderer 2546 // If there is a JavaScript dialog up, don't bother sending the renderer
2547 // the unload event because it is known unresponsive, waiting for the 2547 // the unload event because it is known unresponsive, waiting for the
2548 // reply from the dialog. 2548 // reply from the dialog.
2549 SimulateBeforeUnloadAck(); 2549 SimulateBeforeUnloadAck();
2550 } else { 2550 } else {
2551 beforeunload_timeout_type_ =
2552 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_BEFORE_UNLOAD;
2553 beforeunload_timeout_->Start( 2551 beforeunload_timeout_->Start(
2554 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)); 2552 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS));
2555 send_before_unload_start_time_ = base::TimeTicks::Now(); 2553 send_before_unload_start_time_ = base::TimeTicks::Now();
2556 Send(new FrameMsg_BeforeUnload(routing_id_, is_reload)); 2554 Send(new FrameMsg_BeforeUnload(routing_id_, is_reload));
2557 } 2555 }
2558 } 2556 }
2559 } 2557 }
2560 2558
2561 void RenderFrameHostImpl::SimulateBeforeUnloadAck() { 2559 void RenderFrameHostImpl::SimulateBeforeUnloadAck() {
2562 DCHECK(is_waiting_for_beforeunload_ack_); 2560 DCHECK(is_waiting_for_beforeunload_ack_);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2624 // If executing as part of beforeunload event handling, there may have been 2622 // If executing as part of beforeunload event handling, there may have been
2625 // timers stopped in this frame or a frame up in the frame hierarchy. Restart 2623 // timers stopped in this frame or a frame up in the frame hierarchy. Restart
2626 // any timers that were stopped in OnRunBeforeUnloadConfirm(). 2624 // any timers that were stopped in OnRunBeforeUnloadConfirm().
2627 for (RenderFrameHostImpl* frame = this; frame; frame = frame->GetParent()) { 2625 for (RenderFrameHostImpl* frame = this; frame; frame = frame->GetParent()) {
2628 if (frame->is_waiting_for_beforeunload_ack_) { 2626 if (frame->is_waiting_for_beforeunload_ack_) {
2629 // If we are waiting for a beforeunload ack and the user has suppressed 2627 // If we are waiting for a beforeunload ack and the user has suppressed
2630 // messages, kill the tab immediately. A page that's spamming is 2628 // messages, kill the tab immediately. A page that's spamming is
2631 // presumably malicious, so there's no point in continuing to run its 2629 // presumably malicious, so there's no point in continuing to run its
2632 // script and dragging out the process. 2630 // script and dragging out the process.
2633 if (dialog_was_suppressed) { 2631 if (dialog_was_suppressed) {
2634 UMA_HISTOGRAM_ENUMERATION(
2635 "ChildProcess.HangRendererType",
2636 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_DIALOG_SUPPRESSED,
2637 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_MAX);
2638
2639 frame->SimulateBeforeUnloadAck(); 2632 frame->SimulateBeforeUnloadAck();
2640 } else { 2633 } else {
2641 frame->beforeunload_timeout_type_ =
2642 success
2643 ? RendererUnresponsiveType::RENDERER_UNRESPONSIVE_BEFORE_UNLOAD
2644 : RendererUnresponsiveType::RENDERER_UNRESPONSIVE_DIALOG_CLOSED;
2645 frame->beforeunload_timeout_->Start( 2634 frame->beforeunload_timeout_->Start(
2646 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)); 2635 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS));
2647 } 2636 }
2648 } 2637 }
2649 } 2638 }
2650 } 2639 }
2651 2640
2652 void RenderFrameHostImpl::SendJavaScriptDialogReply( 2641 void RenderFrameHostImpl::SendJavaScriptDialogReply(
2653 IPC::Message* reply_msg, 2642 IPC::Message* reply_msg,
2654 bool success, 2643 bool success,
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
3469 return NavigationHandleImpl::Create( 3458 return NavigationHandleImpl::Create(
3470 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, 3459 params.url, params.redirects, frame_tree_node_, is_renderer_initiated,
3471 params.was_within_same_page, base::TimeTicks::Now(), 3460 params.was_within_same_page, base::TimeTicks::Now(),
3472 entry_id_for_data_nav, false); // started_from_context_menu 3461 entry_id_for_data_nav, false); // started_from_context_menu
3473 } 3462 }
3474 3463
3475 void RenderFrameHostImpl::BeforeUnloadTimeout() { 3464 void RenderFrameHostImpl::BeforeUnloadTimeout() {
3476 if (render_view_host_->GetDelegate()->ShouldIgnoreUnresponsiveRenderer()) 3465 if (render_view_host_->GetDelegate()->ShouldIgnoreUnresponsiveRenderer())
3477 return; 3466 return;
3478 3467
3479 UMA_HISTOGRAM_ENUMERATION(
3480 "ChildProcess.HangRendererType", beforeunload_timeout_type_,
3481 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_MAX);
3482
3483 SimulateBeforeUnloadAck(); 3468 SimulateBeforeUnloadAck();
3484 } 3469 }
3485 3470
3486 } // namespace content 3471 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698