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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2737553003: Remove ChildProcess.HangRendererType. (Closed)
Patch Set: rebase to tot 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <set> 9 #include <set>
10 #include <tuple> 10 #include <tuple>
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 has_touch_handler_(false), 281 has_touch_handler_(false),
282 is_in_touchpad_gesture_scroll_(false), 282 is_in_touchpad_gesture_scroll_(false),
283 is_in_touchscreen_gesture_scroll_(false), 283 is_in_touchscreen_gesture_scroll_(false),
284 received_paint_after_load_(false), 284 received_paint_after_load_(false),
285 latency_tracker_(), 285 latency_tracker_(),
286 next_browser_snapshot_id_(1), 286 next_browser_snapshot_id_(1),
287 owned_by_render_frame_host_(false), 287 owned_by_render_frame_host_(false),
288 is_focused_(false), 288 is_focused_(false),
289 hung_renderer_delay_( 289 hung_renderer_delay_(
290 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), 290 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)),
291 hang_monitor_reason_(
292 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNKNOWN),
293 hang_monitor_event_type_(blink::WebInputEvent::Undefined), 291 hang_monitor_event_type_(blink::WebInputEvent::Undefined),
294 last_event_type_(blink::WebInputEvent::Undefined), 292 last_event_type_(blink::WebInputEvent::Undefined),
295 new_content_rendering_delay_( 293 new_content_rendering_delay_(
296 base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)), 294 base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)),
297 current_content_source_id_(0), 295 current_content_source_id_(0),
298 weak_factory_(this) { 296 weak_factory_(this) {
299 CHECK(delegate_); 297 CHECK(delegate_);
300 CHECK_NE(MSG_ROUTING_NONE, routing_id_); 298 CHECK_NE(MSG_ROUTING_NONE, routing_id_);
301 latency_tracker_.SetDelegate(delegate_); 299 latency_tracker_.SetDelegate(delegate_);
302 300
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 repaint_start_time_ = TimeTicks::Now(); 939 repaint_start_time_ = TimeTicks::Now();
942 repaint_ack_pending_ = true; 940 repaint_ack_pending_ = true;
943 TRACE_EVENT_ASYNC_BEGIN0( 941 TRACE_EVENT_ASYNC_BEGIN0(
944 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this); 942 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this);
945 Send(new ViewMsg_Repaint(routing_id_, current_size_)); 943 Send(new ViewMsg_Repaint(routing_id_, current_size_));
946 return true; 944 return true;
947 } 945 }
948 946
949 void RenderWidgetHostImpl::StartHangMonitorTimeout( 947 void RenderWidgetHostImpl::StartHangMonitorTimeout(
950 base::TimeDelta delay, 948 base::TimeDelta delay,
951 blink::WebInputEvent::Type event_type, 949 blink::WebInputEvent::Type event_type) {
952 RendererUnresponsiveType hang_monitor_reason) {
953 if (!hang_monitor_timeout_) 950 if (!hang_monitor_timeout_)
954 return; 951 return;
955 if (!hang_monitor_timeout_->IsRunning()) 952 if (!hang_monitor_timeout_->IsRunning())
956 hang_monitor_event_type_ = event_type; 953 hang_monitor_event_type_ = event_type;
957 last_event_type_ = event_type; 954 last_event_type_ = event_type;
958 hang_monitor_timeout_->Start(delay); 955 hang_monitor_timeout_->Start(delay);
959 hang_monitor_reason_ = hang_monitor_reason;
960 } 956 }
961 957
962 void RenderWidgetHostImpl::RestartHangMonitorTimeoutIfNecessary() { 958 void RenderWidgetHostImpl::RestartHangMonitorTimeoutIfNecessary() {
963 if (!hang_monitor_timeout_) 959 if (!hang_monitor_timeout_)
964 return; 960 return;
965 if (in_flight_event_count_ > 0 && !is_hidden_) { 961 if (in_flight_event_count_ > 0 && !is_hidden_)
966 if (hang_monitor_reason_ ==
967 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNKNOWN) {
968 hang_monitor_reason_ =
969 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_IN_FLIGHT_EVENTS;
970 }
971 hang_monitor_timeout_->Restart(hung_renderer_delay_); 962 hang_monitor_timeout_->Restart(hung_renderer_delay_);
972 }
973 } 963 }
974 964
975 void RenderWidgetHostImpl::DisableHangMonitorForTesting() { 965 void RenderWidgetHostImpl::DisableHangMonitorForTesting() {
976 StopHangMonitorTimeout(); 966 StopHangMonitorTimeout();
977 hang_monitor_timeout_.reset(); 967 hang_monitor_timeout_.reset();
978 } 968 }
979 969
980 void RenderWidgetHostImpl::StopHangMonitorTimeout() { 970 void RenderWidgetHostImpl::StopHangMonitorTimeout() {
981 if (hang_monitor_timeout_) { 971 if (hang_monitor_timeout_)
982 hang_monitor_timeout_->Stop(); 972 hang_monitor_timeout_->Stop();
983 hang_monitor_reason_ =
984 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNKNOWN;
985 }
986 RendererIsResponsive(); 973 RendererIsResponsive();
987 } 974 }
988 975
989 void RenderWidgetHostImpl::StartNewContentRenderingTimeout( 976 void RenderWidgetHostImpl::StartNewContentRenderingTimeout(
990 uint32_t next_source_id) { 977 uint32_t next_source_id) {
991 current_content_source_id_ = next_source_id; 978 current_content_source_id_ = next_source_id;
992 // It is possible for a compositor frame to arrive before the browser is 979 // It is possible for a compositor frame to arrive before the browser is
993 // notified about the page being committed, in which case no timer is 980 // notified about the page being committed, in which case no timer is
994 // necessary. 981 // necessary.
995 if (received_paint_after_load_) { 982 if (received_paint_after_load_) {
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 delete this; 1684 delete this;
1698 } 1685 }
1699 } 1686 }
1700 1687
1701 void RenderWidgetHostImpl::RendererIsUnresponsive() { 1688 void RenderWidgetHostImpl::RendererIsUnresponsive() {
1702 NotificationService::current()->Notify( 1689 NotificationService::current()->Notify(
1703 NOTIFICATION_RENDER_WIDGET_HOST_HANG, 1690 NOTIFICATION_RENDER_WIDGET_HOST_HANG,
1704 Source<RenderWidgetHost>(this), 1691 Source<RenderWidgetHost>(this),
1705 NotificationService::NoDetails()); 1692 NotificationService::NoDetails());
1706 is_unresponsive_ = true; 1693 is_unresponsive_ = true;
1707 RendererUnresponsiveType reason = hang_monitor_reason_;
1708 hang_monitor_reason_ =
1709 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNKNOWN;
1710 1694
1711 if (delegate_) 1695 if (delegate_)
1712 delegate_->RendererUnresponsive(this, reason); 1696 delegate_->RendererUnresponsive(this);
1713 1697
1714 // Do not add code after this since the Delegate may delete this 1698 // Do not add code after this since the Delegate may delete this
1715 // RenderWidgetHostImpl in RendererUnresponsive. 1699 // RenderWidgetHostImpl in RendererUnresponsive.
1716 } 1700 }
1717 1701
1718 void RenderWidgetHostImpl::RendererIsResponsive() { 1702 void RenderWidgetHostImpl::RendererIsResponsive() {
1719 if (is_unresponsive_) { 1703 if (is_unresponsive_) {
1720 is_unresponsive_ = false; 1704 is_unresponsive_ = false;
1721 if (delegate_) 1705 if (delegate_)
1722 delegate_->RendererResponsive(this); 1706 delegate_->RendererResponsive(this);
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 } 2089 }
2106 } 2090 }
2107 2091
2108 return view_ ? view_->FilterInputEvent(event) 2092 return view_ ? view_->FilterInputEvent(event)
2109 : INPUT_EVENT_ACK_STATE_NOT_CONSUMED; 2093 : INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
2110 } 2094 }
2111 2095
2112 void RenderWidgetHostImpl::IncrementInFlightEventCount( 2096 void RenderWidgetHostImpl::IncrementInFlightEventCount(
2113 blink::WebInputEvent::Type event_type) { 2097 blink::WebInputEvent::Type event_type) {
2114 increment_in_flight_event_count(); 2098 increment_in_flight_event_count();
2115 if (!is_hidden_) { 2099 if (!is_hidden_)
2116 StartHangMonitorTimeout( 2100 StartHangMonitorTimeout(hung_renderer_delay_, event_type);
2117 hung_renderer_delay_, event_type,
2118 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_IN_FLIGHT_EVENTS);
2119 }
2120 } 2101 }
2121 2102
2122 void RenderWidgetHostImpl::DecrementInFlightEventCount( 2103 void RenderWidgetHostImpl::DecrementInFlightEventCount(
2123 InputEventAckSource ack_source) { 2104 InputEventAckSource ack_source) {
2124 if (decrement_in_flight_event_count() <= 0) { 2105 if (decrement_in_flight_event_count() <= 0) {
2125 // Cancel pending hung renderer checks since the renderer is responsive. 2106 // Cancel pending hung renderer checks since the renderer is responsive.
2126 StopHangMonitorTimeout(); 2107 StopHangMonitorTimeout();
2127 } else { 2108 } else {
2128 // Only restart the hang monitor timer if we got a response from the 2109 // Only restart the hang monitor timer if we got a response from the
2129 // main thread. 2110 // main thread.
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
2514 // different from the receiver's. 2495 // different from the receiver's.
2515 file_system_file.url = 2496 file_system_file.url =
2516 GURL(storage::GetIsolatedFileSystemRootURIString( 2497 GURL(storage::GetIsolatedFileSystemRootURIString(
2517 file_system_url.origin(), filesystem_id, std::string()) 2498 file_system_url.origin(), filesystem_id, std::string())
2518 .append(register_name)); 2499 .append(register_name));
2519 file_system_file.filesystem_id = filesystem_id; 2500 file_system_file.filesystem_id = filesystem_id;
2520 } 2501 }
2521 } 2502 }
2522 2503
2523 } // namespace content 2504 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698