OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "content/browser/renderer_host/render_widget_host.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 // WasResized checks the current size and sends the resize update only | 1023 // WasResized checks the current size and sends the resize update only |
1024 // when something was actually changed. | 1024 // when something was actually changed. |
1025 WasResized(); | 1025 WasResized(); |
1026 } | 1026 } |
1027 | 1027 |
1028 // Log the time delta for processing a paint message. | 1028 // Log the time delta for processing a paint message. |
1029 TimeDelta delta = TimeTicks::Now() - paint_start; | 1029 TimeDelta delta = TimeTicks::Now() - paint_start; |
1030 UMA_HISTOGRAM_TIMES("MPArch.RWH_OnMsgUpdateRect", delta); | 1030 UMA_HISTOGRAM_TIMES("MPArch.RWH_OnMsgUpdateRect", delta); |
1031 } | 1031 } |
1032 | 1032 |
1033 void RenderWidgetHost::OnMsgInputEventAck(const IPC::Message& message) { | 1033 void RenderWidgetHost::OnMsgInputEventAck(WebInputEvent::Type event_type, |
| 1034 bool processed) { |
1034 TRACE_EVENT0("renderer_host", "RenderWidgetHost::OnMsgInputEventAck"); | 1035 TRACE_EVENT0("renderer_host", "RenderWidgetHost::OnMsgInputEventAck"); |
1035 | 1036 |
1036 // Log the time delta for processing an input event. | 1037 // Log the time delta for processing an input event. |
1037 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; | 1038 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; |
1038 UMA_HISTOGRAM_TIMES("MPArch.RWH_InputEventDelta", delta); | 1039 UMA_HISTOGRAM_TIMES("MPArch.RWH_InputEventDelta", delta); |
1039 | 1040 |
1040 // Cancel pending hung renderer checks since the renderer is responsive. | 1041 // Cancel pending hung renderer checks since the renderer is responsive. |
1041 StopHangMonitorTimeout(); | 1042 StopHangMonitorTimeout(); |
1042 | 1043 |
1043 void* iter = NULL; | 1044 int type = static_cast<int>(event_type); |
1044 int type = 0; | 1045 if (type < WebInputEvent::Undefined) { |
1045 if (!message.ReadInt(&iter, &type) || (type < WebInputEvent::Undefined)) { | |
1046 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RWH2")); | 1046 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RWH2")); |
1047 process()->ReceivedBadMessage(); | 1047 process()->ReceivedBadMessage(); |
1048 } else if (type == WebInputEvent::MouseMove) { | 1048 } else if (type == WebInputEvent::MouseMove) { |
1049 mouse_move_pending_ = false; | 1049 mouse_move_pending_ = false; |
1050 | 1050 |
1051 // now, we can send the next mouse move event | 1051 // now, we can send the next mouse move event |
1052 if (next_mouse_move_.get()) { | 1052 if (next_mouse_move_.get()) { |
1053 DCHECK(next_mouse_move_->type == WebInputEvent::MouseMove); | 1053 DCHECK(next_mouse_move_->type == WebInputEvent::MouseMove); |
1054 ForwardMouseEvent(*next_mouse_move_); | 1054 ForwardMouseEvent(*next_mouse_move_); |
1055 } | 1055 } |
1056 } else if (WebInputEvent::isKeyboardEventType(type)) { | 1056 } else if (WebInputEvent::isKeyboardEventType(type)) { |
1057 bool processed = false; | |
1058 if (!message.ReadBool(&iter, &processed)) { | |
1059 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RWH3")); | |
1060 process()->ReceivedBadMessage(); | |
1061 } | |
1062 | |
1063 ProcessKeyboardEventAck(type, processed); | 1057 ProcessKeyboardEventAck(type, processed); |
1064 } else if (type == WebInputEvent::MouseWheel) { | 1058 } else if (type == WebInputEvent::MouseWheel) { |
1065 bool processed = false; | |
1066 if (!message.ReadBool(&iter, &processed)) { | |
1067 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RWH4")); | |
1068 process()->ReceivedBadMessage(); | |
1069 } | |
1070 | |
1071 ProcessWheelAck(processed); | 1059 ProcessWheelAck(processed); |
1072 } else if (type == WebInputEvent::TouchMove) { | 1060 } else if (type == WebInputEvent::TouchMove) { |
1073 touch_move_pending_ = false; | 1061 touch_move_pending_ = false; |
1074 if (touch_event_is_queued_) { | 1062 if (touch_event_is_queued_) { |
1075 touch_event_is_queued_ = false; | 1063 touch_event_is_queued_ = false; |
1076 ForwardTouchEvent(queued_touch_event_); | 1064 ForwardTouchEvent(queued_touch_event_); |
1077 } | 1065 } |
1078 } | 1066 } |
1079 // This is used only for testing. | 1067 // This is used only for testing. |
1080 NotificationService::current()->Notify( | 1068 NotificationService::current()->Notify( |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 void RenderWidgetHost::Delete() { | 1368 void RenderWidgetHost::Delete() { |
1381 Send(new ViewMsg_Delete(routing_id())); | 1369 Send(new ViewMsg_Delete(routing_id())); |
1382 UserMetrics::RecordAction(UserMetricsAction("DeleteSelection")); | 1370 UserMetrics::RecordAction(UserMetricsAction("DeleteSelection")); |
1383 } | 1371 } |
1384 | 1372 |
1385 void RenderWidgetHost::SelectAll() { | 1373 void RenderWidgetHost::SelectAll() { |
1386 Send(new ViewMsg_SelectAll(routing_id())); | 1374 Send(new ViewMsg_SelectAll(routing_id())); |
1387 UserMetrics::RecordAction(UserMetricsAction("SelectAll")); | 1375 UserMetrics::RecordAction(UserMetricsAction("SelectAll")); |
1388 } | 1376 } |
1389 | 1377 |
OLD | NEW |