| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/input/input_router_impl.h" | 5 #include "content/browser/renderer_host/input/input_router_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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 namespace content { | 46 namespace content { |
| 47 namespace { | 47 namespace { |
| 48 | 48 |
| 49 const char* GetEventAckName(InputEventAckState ack_result) { | 49 const char* GetEventAckName(InputEventAckState ack_result) { |
| 50 switch(ack_result) { | 50 switch(ack_result) { |
| 51 case INPUT_EVENT_ACK_STATE_UNKNOWN: return "UNKNOWN"; | 51 case INPUT_EVENT_ACK_STATE_UNKNOWN: return "UNKNOWN"; |
| 52 case INPUT_EVENT_ACK_STATE_CONSUMED: return "CONSUMED"; | 52 case INPUT_EVENT_ACK_STATE_CONSUMED: return "CONSUMED"; |
| 53 case INPUT_EVENT_ACK_STATE_NOT_CONSUMED: return "NOT_CONSUMED"; | 53 case INPUT_EVENT_ACK_STATE_NOT_CONSUMED: return "NOT_CONSUMED"; |
| 54 case INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS: return "NO_CONSUMER_EXISTS"; | 54 case INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS: return "NO_CONSUMER_EXISTS"; |
| 55 case INPUT_EVENT_ACK_STATE_IGNORED: return "IGNORED"; | 55 case INPUT_EVENT_ACK_STATE_IGNORED: return "IGNORED"; |
| 56 case INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING: |
| 57 return "SET_NON_BLOCKING"; |
| 56 } | 58 } |
| 57 DLOG(WARNING) << "Unhandled InputEventAckState in GetEventAckName."; | 59 DLOG(WARNING) << "Unhandled InputEventAckState in GetEventAckName."; |
| 58 return ""; | 60 return ""; |
| 59 } | 61 } |
| 60 | 62 |
| 61 } // namespace | 63 } // namespace |
| 62 | 64 |
| 63 InputRouterImpl::Config::Config() { | 65 InputRouterImpl::Config::Config() { |
| 64 } | 66 } |
| 65 | 67 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 bool InputRouterImpl::OfferToRenderer(const WebInputEvent& input_event, | 405 bool InputRouterImpl::OfferToRenderer(const WebInputEvent& input_event, |
| 404 const ui::LatencyInfo& latency_info) { | 406 const ui::LatencyInfo& latency_info) { |
| 405 // This conversion is temporary. WebInputEvent should be generated | 407 // This conversion is temporary. WebInputEvent should be generated |
| 406 // directly from ui::Event with the viewport coordinates. See | 408 // directly from ui::Event with the viewport coordinates. See |
| 407 // crbug.com/563730. | 409 // crbug.com/563730. |
| 408 scoped_ptr<blink::WebInputEvent> event_in_viewport = | 410 scoped_ptr<blink::WebInputEvent> event_in_viewport = |
| 409 ui::ScaleWebInputEvent(input_event, device_scale_factor_); | 411 ui::ScaleWebInputEvent(input_event, device_scale_factor_); |
| 410 const WebInputEvent* event_to_send = | 412 const WebInputEvent* event_to_send = |
| 411 event_in_viewport ? event_in_viewport.get() : &input_event; | 413 event_in_viewport ? event_in_viewport.get() : &input_event; |
| 412 | 414 |
| 413 if (Send(new InputMsg_HandleInputEvent(routing_id(), event_to_send, | 415 if (Send(new InputMsg_HandleInputEvent( |
| 414 latency_info))) { | 416 routing_id(), event_to_send, latency_info, |
| 417 InputEventDispatchType::DISPATCH_TYPE_NORMAL))) { |
| 415 // Ack messages for ignored ack event types should never be sent by the | 418 // Ack messages for ignored ack event types should never be sent by the |
| 416 // renderer. Consequently, such event types should not affect event time | 419 // renderer. Consequently, such event types should not affect event time |
| 417 // or in-flight event count metrics. | 420 // or in-flight event count metrics. |
| 418 if (WebInputEventTraits::WillReceiveAckFromRenderer(*event_to_send)) { | 421 if (WebInputEventTraits::WillReceiveAckFromRenderer(*event_to_send)) { |
| 419 input_event_start_time_ = TimeTicks::Now(); | 422 input_event_start_time_ = TimeTicks::Now(); |
| 420 client_->IncrementInFlightEventCount(); | 423 client_->IncrementInFlightEventCount(); |
| 421 } | 424 } |
| 422 return true; | 425 return true; |
| 423 } | 426 } |
| 424 return false; | 427 return false; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 | 624 |
| 622 flush_requested_ = false; | 625 flush_requested_ = false; |
| 623 client_->DidFlush(); | 626 client_->DidFlush(); |
| 624 } | 627 } |
| 625 | 628 |
| 626 void InputRouterImpl::SetFrameTreeNodeId(int frameTreeNodeId) { | 629 void InputRouterImpl::SetFrameTreeNodeId(int frameTreeNodeId) { |
| 627 frame_tree_node_id_ = frameTreeNodeId; | 630 frame_tree_node_id_ = frameTreeNodeId; |
| 628 } | 631 } |
| 629 | 632 |
| 630 } // namespace content | 633 } // namespace content |
| OLD | NEW |