Chromium Code Reviews| Index: content/renderer/gpu/input_event_filter.cc |
| diff --git a/content/renderer/gpu/input_event_filter.cc b/content/renderer/gpu/input_event_filter.cc |
| index 0db5814b2c0ab767d334bfb7b0a8cd556b1a00cc..95de92ca252082bd71437f7e9aa610820f99085c 100644 |
| --- a/content/renderer/gpu/input_event_filter.cc |
| +++ b/content/renderer/gpu/input_event_filter.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/debug/trace_event.h" |
| #include "base/location.h" |
| #include "base/message_loop/message_loop_proxy.h" |
| +#include "base/metrics/histogram.h" |
| #include "content/common/input_messages.h" |
| #include "content/common/view_messages.h" |
| #include "content/public/common/content_switches.h" |
| @@ -106,7 +107,8 @@ bool InputEventFilter::OnMessageReceived(const IPC::Message& message) { |
| // static |
| const WebInputEvent* InputEventFilter::CrackMessage( |
| const IPC::Message& message, |
| - ui::LatencyInfo* latency_info) { |
| + ui::LatencyInfo* latency_info, |
| + bool* is_keyboard_shortcut) { |
| DCHECK(message.type() == InputMsg_HandleInputEvent::ID); |
| PickleIterator iter(message); |
| @@ -114,6 +116,8 @@ const WebInputEvent* InputEventFilter::CrackMessage( |
| IPC::ParamTraits<IPC::WebInputEventPointer>::Read(&message, &iter, &event); |
| if (latency_info) |
| IPC::ParamTraits<ui::LatencyInfo>::Read(&message, &iter, latency_info); |
| + if (is_keyboard_shortcut) |
| + IPC::ParamTraits<bool>::Read(&message, &iter, is_keyboard_shortcut); |
| return event; |
| } |
| @@ -121,7 +125,21 @@ InputEventFilter::~InputEventFilter() { |
| } |
| void InputEventFilter::ForwardToMainListener(const IPC::Message& message) { |
| - main_listener_->OnMessageReceived(message); |
| + if (message.type() != InputMsg_HandleInputEvent::ID) { |
| + main_listener_->OnMessageReceived(message); |
| + return; |
| + } |
| + ui::LatencyInfo latency_info; |
| + bool is_keyboard_shortcut; |
| + const WebInputEvent* event = CrackMessage(message, &latency_info, |
| + &is_keyboard_shortcut); |
| + |
| + latency_info.AddLatencyNumber( |
| + ui::INPUT_EVENT_LATENCY_RECEIVED_ON_MAIN_THREAD_COMPONENT, |
| + message.routing_id(), 0); |
| + |
| + main_listener_->OnMessageReceived(InputMsg_HandleInputEvent( |
| + message.routing_id(), event, latency_info, is_keyboard_shortcut)); |
| } |
| void InputEventFilter::ForwardToHandler(const IPC::Message& message) { |
| @@ -137,17 +155,23 @@ void InputEventFilter::ForwardToHandler(const IPC::Message& message) { |
| } |
| ui::LatencyInfo latency_info; |
| - const WebInputEvent* event = CrackMessage(message, &latency_info); |
| + bool is_keyboard_shortcut; |
| + const WebInputEvent* event = CrackMessage(message, &latency_info, |
| + &is_keyboard_shortcut); |
| InputEventAckState ack = |
| handler_.Run(message.routing_id(), event, latency_info); |
| if (ack == INPUT_EVENT_ACK_STATE_NOT_CONSUMED) { |
| TRACE_EVENT0("input", "InputEventFilter::ForwardToHandler"); |
| + latency_info.AddLatencyNumber( |
| + ui::INPUT_EVENT_LATENCY_SENT_FROM_IMPL_THREAD_COMPONENT, |
|
nduca
2013/07/08 20:58:32
is this enum clearly named?
|
| + message.routing_id(), 0); |
|
nduca
2013/07/08 20:58:32
why are you passing zero here? that seems like abu
|
| main_loop_->PostTask( |
| FROM_HERE, |
| base::Bind(&InputEventFilter::ForwardToMainListener, |
| - this, message)); |
| + this, InputMsg_HandleInputEvent(message.routing_id(), event, |
| + latency_info, is_keyboard_shortcut))); |
| return; |
| } |
| @@ -163,7 +187,7 @@ void InputEventFilter::SendACK(const IPC::Message& message, |
| base::Bind(&InputEventFilter::SendMessageOnIOThread, this, |
| InputHostMsg_HandleInputEvent_ACK( |
| message.routing_id(), |
| - CrackMessage(message, NULL)->type, |
| + CrackMessage(message, NULL, NULL)->type, |
| ack_result))); |
| } |