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

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: fixes 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 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(reply_msg, true, base::string16(),
1673 /*is_before_unload_dialog=*/false,
1674 /*dialog_was_suppressed=*/true);
1673 return; 1675 return;
1674 } 1676 }
1675 1677
1676 int32_t message_length = static_cast<int32_t>(message.length()); 1678 int32_t message_length = static_cast<int32_t>(message.length());
1677 if (GetParent()) { 1679 if (GetParent()) {
1678 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.Subframe", message_length); 1680 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.Subframe", message_length);
1679 } else { 1681 } else {
1680 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.MainFrame", message_length); 1682 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.MainFrame", message_length);
1681 } 1683 }
1682 1684
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 } 2600 }
2599 2601
2600 void RenderFrameHostImpl::DeleteSurroundingText(size_t before, size_t after) { 2602 void RenderFrameHostImpl::DeleteSurroundingText(size_t before, size_t after) {
2601 Send(new InputMsg_DeleteSurroundingText(routing_id_, before, after)); 2603 Send(new InputMsg_DeleteSurroundingText(routing_id_, before, after));
2602 } 2604 }
2603 2605
2604 void RenderFrameHostImpl::JavaScriptDialogClosed( 2606 void RenderFrameHostImpl::JavaScriptDialogClosed(
2605 IPC::Message* reply_msg, 2607 IPC::Message* reply_msg,
2606 bool success, 2608 bool success,
2607 const base::string16& user_input, 2609 const base::string16& user_input,
2610 bool is_before_unload_dialog,
2608 bool dialog_was_suppressed) { 2611 bool dialog_was_suppressed) {
2609 GetProcess()->SetIgnoreInputEvents(false); 2612 GetProcess()->SetIgnoreInputEvents(false);
2610 bool is_waiting = is_waiting_for_beforeunload_ack_ || IsWaitingForUnloadACK(); 2613 bool is_waiting = is_before_unload_dialog || IsWaitingForUnloadACK();
2611 2614
2612 // If we are executing as part of (before)unload event handling, we don't 2615 // 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 2616 // 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 2617 // leave the current page. In this case, use the regular timeout value used
2615 // during the (before)unload handling. 2618 // during the (before)unload handling.
2616 if (is_waiting) { 2619 if (is_waiting) {
2617 RendererUnresponsiveType type = 2620 RendererUnresponsiveType type =
2618 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_DIALOG_CLOSED; 2621 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_DIALOG_CLOSED;
2619 if (success) { 2622 if (success) {
2620 type = is_waiting_for_beforeunload_ack_ 2623 type = is_before_unload_dialog
2621 ? RendererUnresponsiveType::RENDERER_UNRESPONSIVE_BEFORE_UNLOAD 2624 ? RendererUnresponsiveType::RENDERER_UNRESPONSIVE_BEFORE_UNLOAD
2622 : RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNLOAD; 2625 : RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNLOAD;
2623 } 2626 }
2624 render_view_host_->GetWidget()->StartHangMonitorTimeout( 2627 render_view_host_->GetWidget()->StartHangMonitorTimeout(
2625 success 2628 success
2626 ? TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS) 2629 ? TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)
2627 : render_view_host_->GetWidget()->hung_renderer_delay(), 2630 : render_view_host_->GetWidget()->hung_renderer_delay(),
2628 blink::WebInputEvent::Undefined, type); 2631 blink::WebInputEvent::Undefined, type);
2629 } 2632 }
2630 2633
(...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 3450 // 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 3451 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3449 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3452 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3450 return NavigationHandleImpl::Create( 3453 return NavigationHandleImpl::Create(
3451 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, 3454 params.url, params.redirects, frame_tree_node_, is_renderer_initiated,
3452 params.was_within_same_page, base::TimeTicks::Now(), 3455 params.was_within_same_page, base::TimeTicks::Now(),
3453 entry_id_for_data_nav, false); // started_from_context_menu 3456 entry_id_for_data_nav, false); // started_from_context_menu
3454 } 3457 }
3455 3458
3456 } // namespace content 3459 } // 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