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

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

Issue 2704383007: Always restart the hung page timer after a beforeunload dialog. (Closed)
Patch Set: Created 3 years, 10 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 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1662 } 1662 }
1663 } 1663 }
1664 1664
1665 void RenderFrameHostImpl::OnRunJavaScriptDialog( 1665 void RenderFrameHostImpl::OnRunJavaScriptDialog(
1666 const base::string16& message, 1666 const base::string16& message,
1667 const base::string16& default_prompt, 1667 const base::string16& default_prompt,
1668 const GURL& frame_url, 1668 const GURL& frame_url,
1669 JavaScriptDialogType dialog_type, 1669 JavaScriptDialogType dialog_type,
1670 IPC::Message* reply_msg) { 1670 IPC::Message* reply_msg) {
1671 if (!is_active()) { 1671 if (!is_active()) {
1672 JavaScriptDialogClosed(reply_msg, true, base::string16(), true); 1672 JavaScriptDialogClosed(false, reply_msg, true, base::string16(), true);
1673 return; 1673 return;
1674 } 1674 }
1675 1675
1676 int32_t message_length = static_cast<int32_t>(message.length()); 1676 int32_t message_length = static_cast<int32_t>(message.length());
1677 if (GetParent()) { 1677 if (GetParent()) {
1678 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.Subframe", message_length); 1678 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.Subframe", message_length);
1679 } else { 1679 } else {
1680 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.MainFrame", message_length); 1680 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.MainFrame", message_length);
1681 } 1681 }
1682 1682
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
2595 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before, 2595 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before,
2596 size_t after) { 2596 size_t after) {
2597 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after)); 2597 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after));
2598 } 2598 }
2599 2599
2600 void RenderFrameHostImpl::DeleteSurroundingText(size_t before, size_t after) { 2600 void RenderFrameHostImpl::DeleteSurroundingText(size_t before, size_t after) {
2601 Send(new InputMsg_DeleteSurroundingText(routing_id_, before, after)); 2601 Send(new InputMsg_DeleteSurroundingText(routing_id_, before, after));
2602 } 2602 }
2603 2603
2604 void RenderFrameHostImpl::JavaScriptDialogClosed( 2604 void RenderFrameHostImpl::JavaScriptDialogClosed(
2605 bool is_before_unload_dialog,
2605 IPC::Message* reply_msg, 2606 IPC::Message* reply_msg,
2606 bool success, 2607 bool success,
2607 const base::string16& user_input, 2608 const base::string16& user_input,
2608 bool dialog_was_suppressed) { 2609 bool dialog_was_suppressed) {
2609 GetProcess()->SetIgnoreInputEvents(false); 2610 GetProcess()->SetIgnoreInputEvents(false);
2610 bool is_waiting = is_waiting_for_beforeunload_ack_ || IsWaitingForUnloadACK(); 2611 bool is_waiting = is_before_unload_dialog || IsWaitingForUnloadACK();
Charlie Reis 2017/02/27 18:41:41 Could the same bug affect IsWaitingForUnloadACK()?
Avi (use Gerrit) 2017/02/27 19:28:49 I just got my brain around is_waiting_for_beforeun
Charlie Reis 2017/02/27 21:03:16 Yeah, throughout this method. We might want to sa
2611 2612
2612 // If we are executing as part of (before)unload event handling, we don't 2613 // If we are executing as part of (before)unload event handling, we don't
2613 // want to use the regular hung_renderer_delay_ms_ if the user has agreed to 2614 // want to use the regular hung_renderer_delay_ms_ if the user has agreed to
2614 // leave the current page. In this case, use the regular timeout value used 2615 // leave the current page. In this case, use the regular timeout value used
2615 // during the (before)unload handling. 2616 // during the (before)unload handling.
2616 if (is_waiting) { 2617 if (is_waiting) {
2617 RendererUnresponsiveType type = 2618 RendererUnresponsiveType type =
2618 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_DIALOG_CLOSED; 2619 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_DIALOG_CLOSED;
2619 if (success) { 2620 if (success) {
2620 type = is_waiting_for_beforeunload_ack_ 2621 type = is_before_unload_dialog
2621 ? RendererUnresponsiveType::RENDERER_UNRESPONSIVE_BEFORE_UNLOAD 2622 ? RendererUnresponsiveType::RENDERER_UNRESPONSIVE_BEFORE_UNLOAD
2622 : RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNLOAD; 2623 : RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNLOAD;
2623 } 2624 }
2624 render_view_host_->GetWidget()->StartHangMonitorTimeout( 2625 render_view_host_->GetWidget()->StartHangMonitorTimeout(
2625 success 2626 success
2626 ? TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS) 2627 ? TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)
2627 : render_view_host_->GetWidget()->hung_renderer_delay(), 2628 : render_view_host_->GetWidget()->hung_renderer_delay(),
2628 blink::WebInputEvent::Undefined, type); 2629 blink::WebInputEvent::Undefined, type);
2629 } 2630 }
2630 2631
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
3447 // There is no pending NavigationEntry in these cases, so pass 0 as the 3448 // There is no pending NavigationEntry in these cases, so pass 0 as the
3448 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3449 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3449 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3450 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3450 return NavigationHandleImpl::Create( 3451 return NavigationHandleImpl::Create(
3451 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, 3452 params.url, params.redirects, frame_tree_node_, is_renderer_initiated,
3452 params.was_within_same_page, base::TimeTicks::Now(), 3453 params.was_within_same_page, base::TimeTicks::Now(),
3453 entry_id_for_data_nav, false); // started_from_context_menu 3454 entry_id_for_data_nav, false); // started_from_context_menu
3454 } 3455 }
3455 3456
3456 } // namespace content 3457 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698