OLD | NEW |
---|---|
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 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
954 repaint_ack_pending_ = true; | 954 repaint_ack_pending_ = true; |
955 TRACE_EVENT_ASYNC_BEGIN0( | 955 TRACE_EVENT_ASYNC_BEGIN0( |
956 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this); | 956 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this); |
957 Send(new ViewMsg_Repaint(routing_id_, current_size_)); | 957 Send(new ViewMsg_Repaint(routing_id_, current_size_)); |
958 return true; | 958 return true; |
959 } | 959 } |
960 | 960 |
961 void RenderWidgetHostImpl::StartHangMonitorTimeout( | 961 void RenderWidgetHostImpl::StartHangMonitorTimeout( |
962 base::TimeDelta delay, | 962 base::TimeDelta delay, |
963 blink::WebInputEvent::Type event_type) { | 963 blink::WebInputEvent::Type event_type) { |
964 if (hang_start_time_.is_null()) | |
965 hang_start_time_ = TimeTicks::Now(); | |
964 if (!hang_monitor_timeout_) | 966 if (!hang_monitor_timeout_) |
965 return; | 967 return; |
966 if (!hang_monitor_timeout_->IsRunning()) | 968 if (!hang_monitor_timeout_->IsRunning()) |
967 hang_monitor_event_type_ = event_type; | 969 hang_monitor_event_type_ = event_type; |
968 last_event_type_ = event_type; | 970 last_event_type_ = event_type; |
969 hang_monitor_timeout_->Start(delay); | 971 hang_monitor_timeout_->Start(delay); |
970 } | 972 } |
971 | 973 |
972 void RenderWidgetHostImpl::RestartHangMonitorTimeoutIfNecessary() { | 974 void RenderWidgetHostImpl::RestartHangMonitorTimeoutIfNecessary() { |
973 if (!hang_monitor_timeout_) | 975 if (in_flight_event_count_ > 0 && !is_hidden_) { |
974 return; | 976 if (!hang_start_time_.is_null()) |
Ilya Sherman
2017/03/24 21:16:19
nit: Please use curly braces, since the body of th
| |
975 if (in_flight_event_count_ > 0 && !is_hidden_) | 977 UMA_HISTOGRAM_TIMES("MPArch.RWH_HangMonitorUnresponsive", |
976 hang_monitor_timeout_->Restart(hung_renderer_delay_); | 978 TimeTicks::Now() - hang_start_time_); |
979 hang_start_time_ = TimeTicks::Now(); | |
980 if (hang_monitor_timeout_) | |
981 hang_monitor_timeout_->Restart(hung_renderer_delay_); | |
982 } | |
977 } | 983 } |
978 | 984 |
979 void RenderWidgetHostImpl::DisableHangMonitorForTesting() { | 985 void RenderWidgetHostImpl::DisableHangMonitorForTesting() { |
980 StopHangMonitorTimeout(); | 986 StopHangMonitorTimeout(); |
981 hang_monitor_timeout_.reset(); | 987 hang_monitor_timeout_.reset(); |
982 } | 988 } |
983 | 989 |
984 void RenderWidgetHostImpl::StopHangMonitorTimeout() { | 990 void RenderWidgetHostImpl::StopHangMonitorTimeout() { |
991 if (!hang_start_time_.is_null()) | |
992 UMA_HISTOGRAM_TIMES("MPArch.RWH_HangMonitorUnresponsive", | |
993 TimeTicks::Now() - hang_start_time_); | |
994 hang_start_time_ = TimeTicks(); | |
Ilya Sherman
2017/03/24 21:16:19
Could you please factor out these four lines of sh
| |
985 if (hang_monitor_timeout_) | 995 if (hang_monitor_timeout_) |
986 hang_monitor_timeout_->Stop(); | 996 hang_monitor_timeout_->Stop(); |
987 RendererIsResponsive(); | 997 RendererIsResponsive(); |
988 } | 998 } |
989 | 999 |
990 void RenderWidgetHostImpl::StartNewContentRenderingTimeout( | 1000 void RenderWidgetHostImpl::StartNewContentRenderingTimeout( |
991 uint32_t next_source_id) { | 1001 uint32_t next_source_id) { |
992 current_content_source_id_ = next_source_id; | 1002 current_content_source_id_ = next_source_id; |
993 // It is possible for a compositor frame to arrive before the browser is | 1003 // It is possible for a compositor frame to arrive before the browser is |
994 // notified about the page being committed, in which case no timer is | 1004 // notified about the page being committed, in which case no timer is |
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2629 void RenderWidgetHostImpl::RequestCompositionUpdates(bool immediate_request, | 2639 void RenderWidgetHostImpl::RequestCompositionUpdates(bool immediate_request, |
2630 bool monitor_updates) { | 2640 bool monitor_updates) { |
2631 if (!immediate_request && monitor_updates == monitoring_composition_info_) | 2641 if (!immediate_request && monitor_updates == monitoring_composition_info_) |
2632 return; | 2642 return; |
2633 monitoring_composition_info_ = monitor_updates; | 2643 monitoring_composition_info_ = monitor_updates; |
2634 Send(new InputMsg_RequestCompositionUpdates(routing_id_, immediate_request, | 2644 Send(new InputMsg_RequestCompositionUpdates(routing_id_, immediate_request, |
2635 monitor_updates)); | 2645 monitor_updates)); |
2636 } | 2646 } |
2637 | 2647 |
2638 } // namespace content | 2648 } // namespace content |
OLD | NEW |