| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 void RenderWidgetHostImpl::ForwardInputEvent(const WebInputEvent& input_event, | 1009 void RenderWidgetHostImpl::ForwardInputEvent(const WebInputEvent& input_event, |
| 1010 int event_size, | 1010 int event_size, |
| 1011 bool is_keyboard_shortcut) { | 1011 bool is_keyboard_shortcut) { |
| 1012 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::ForwardInputEvent"); | 1012 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::ForwardInputEvent"); |
| 1013 | 1013 |
| 1014 if (!process_->HasConnection()) | 1014 if (!process_->HasConnection()) |
| 1015 return; | 1015 return; |
| 1016 | 1016 |
| 1017 DCHECK(!process_->IgnoreInputEvents()); | 1017 DCHECK(!process_->IgnoreInputEvents()); |
| 1018 | 1018 |
| 1019 in_process_event_types_.push(input_event.type); |
| 1020 |
| 1019 IPC::Message* message = new ViewMsg_HandleInputEvent(routing_id_); | 1021 IPC::Message* message = new ViewMsg_HandleInputEvent(routing_id_); |
| 1020 message->WriteData( | 1022 message->WriteData( |
| 1021 reinterpret_cast<const char*>(&input_event), event_size); | 1023 reinterpret_cast<const char*>(&input_event), event_size); |
| 1022 // |is_keyboard_shortcut| only makes sense for RawKeyDown events. | 1024 // |is_keyboard_shortcut| only makes sense for RawKeyDown events. |
| 1023 if (input_event.type == WebInputEvent::RawKeyDown) | 1025 if (input_event.type == WebInputEvent::RawKeyDown) |
| 1024 message->WriteBool(is_keyboard_shortcut); | 1026 message->WriteBool(is_keyboard_shortcut); |
| 1025 input_event_start_time_ = TimeTicks::Now(); | 1027 input_event_start_time_ = TimeTicks::Now(); |
| 1026 Send(message); | 1028 Send(message); |
| 1027 | 1029 |
| 1028 // Any non-wheel input event cancels pending wheel events. | 1030 // Any non-wheel input event cancels pending wheel events. |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 // On other platforms, this will be equivalent to MPArch.RWH_OnMsgUpdateRect. | 1529 // On other platforms, this will be equivalent to MPArch.RWH_OnMsgUpdateRect. |
| 1528 delta = now - paint_start; | 1530 delta = now - paint_start; |
| 1529 UMA_HISTOGRAM_TIMES("MPArch.RWH_TotalPaintTime", delta); | 1531 UMA_HISTOGRAM_TIMES("MPArch.RWH_TotalPaintTime", delta); |
| 1530 UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectComplete", | 1532 UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectComplete", |
| 1531 "x+y", params.bitmap_rect.x() + params.bitmap_rect.y()); | 1533 "x+y", params.bitmap_rect.x() + params.bitmap_rect.y()); |
| 1532 } | 1534 } |
| 1533 | 1535 |
| 1534 void RenderWidgetHostImpl::OnMsgInputEventAck(WebInputEvent::Type event_type, | 1536 void RenderWidgetHostImpl::OnMsgInputEventAck(WebInputEvent::Type event_type, |
| 1535 bool processed) { | 1537 bool processed) { |
| 1536 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnMsgInputEventAck"); | 1538 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnMsgInputEventAck"); |
| 1539 if (!in_process_event_types_.empty() && |
| 1540 in_process_event_types_.front() == event_type) |
| 1541 in_process_event_types_.pop(); |
| 1537 | 1542 |
| 1538 // Log the time delta for processing an input event. | 1543 // Log the time delta for processing an input event. |
| 1539 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; | 1544 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; |
| 1540 UMA_HISTOGRAM_TIMES("MPArch.RWH_InputEventDelta", delta); | 1545 UMA_HISTOGRAM_TIMES("MPArch.RWH_InputEventDelta", delta); |
| 1541 | 1546 |
| 1542 // Cancel pending hung renderer checks since the renderer is responsive. | 1547 // Cancel pending hung renderer checks since the renderer is responsive. |
| 1543 if (decrement_in_flight_event_count() == 0) | 1548 if (decrement_in_flight_event_count() == 0) |
| 1544 StopHangMonitorTimeout(); | 1549 StopHangMonitorTimeout(); |
| 1545 | 1550 |
| 1546 int type = static_cast<int>(event_type); | 1551 int type = static_cast<int>(event_type); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2042 // indicate that no callback is in progress (i.e. without this line | 2047 // indicate that no callback is in progress (i.e. without this line |
| 2043 // DelayedAutoResized will not get called again). | 2048 // DelayedAutoResized will not get called again). |
| 2044 new_auto_size_.SetSize(0, 0); | 2049 new_auto_size_.SetSize(0, 0); |
| 2045 if (!should_auto_resize_) | 2050 if (!should_auto_resize_) |
| 2046 return; | 2051 return; |
| 2047 | 2052 |
| 2048 OnRenderAutoResized(new_size); | 2053 OnRenderAutoResized(new_size); |
| 2049 } | 2054 } |
| 2050 | 2055 |
| 2051 } // namespace content | 2056 } // namespace content |
| OLD | NEW |