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/renderer/input/input_handler_manager.h" | 5 #include "content/renderer/input/input_handler_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "cc/input/input_handler.h" | 10 #include "cc/input/input_handler.h" |
11 #include "content/renderer/input/input_event_filter.h" | 11 #include "content/renderer/input/input_event_filter.h" |
12 #include "content/renderer/input/input_handler_manager_client.h" | 12 #include "content/renderer/input/input_handler_manager_client.h" |
13 #include "content/renderer/input/input_handler_wrapper.h" | 13 #include "content/renderer/input/input_handler_wrapper.h" |
| 14 #include "content/renderer/scheduler/renderer_scheduler.h" |
14 | 15 |
15 using blink::WebInputEvent; | 16 using blink::WebInputEvent; |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 InputEventAckState InputEventDispositionToAck( | 22 InputEventAckState InputEventDispositionToAck( |
22 InputHandlerProxy::EventDisposition disposition) { | 23 InputHandlerProxy::EventDisposition disposition) { |
23 switch (disposition) { | 24 switch (disposition) { |
24 case InputHandlerProxy::DID_HANDLE: | 25 case InputHandlerProxy::DID_HANDLE: |
25 return INPUT_EVENT_ACK_STATE_CONSUMED; | 26 return INPUT_EVENT_ACK_STATE_CONSUMED; |
26 case InputHandlerProxy::DID_NOT_HANDLE: | 27 case InputHandlerProxy::DID_NOT_HANDLE: |
27 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 28 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
28 case InputHandlerProxy::DROP_EVENT: | 29 case InputHandlerProxy::DROP_EVENT: |
29 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | 30 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
30 } | 31 } |
31 NOTREACHED(); | 32 NOTREACHED(); |
32 return INPUT_EVENT_ACK_STATE_UNKNOWN; | 33 return INPUT_EVENT_ACK_STATE_UNKNOWN; |
33 } | 34 } |
34 | 35 |
35 } // namespace | 36 } // namespace |
36 | 37 |
37 InputHandlerManager::InputHandlerManager( | 38 InputHandlerManager::InputHandlerManager( |
38 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, | 39 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, |
39 InputHandlerManagerClient* client) | 40 InputHandlerManagerClient* client, |
| 41 RendererScheduler* renderer_scheduler) |
40 : message_loop_proxy_(message_loop_proxy), | 42 : message_loop_proxy_(message_loop_proxy), |
41 client_(client) { | 43 client_(client), |
| 44 renderer_scheduler_(renderer_scheduler) { |
42 DCHECK(client_); | 45 DCHECK(client_); |
43 client_->SetBoundHandler(base::Bind(&InputHandlerManager::HandleInputEvent, | 46 client_->SetBoundHandler(base::Bind(&InputHandlerManager::HandleInputEvent, |
44 base::Unretained(this))); | 47 base::Unretained(this))); |
45 } | 48 } |
46 | 49 |
47 InputHandlerManager::~InputHandlerManager() { | 50 InputHandlerManager::~InputHandlerManager() { |
48 client_->SetBoundHandler(InputHandlerManagerClient::Handler()); | 51 client_->SetBoundHandler(InputHandlerManagerClient::Handler()); |
49 } | 52 } |
50 | 53 |
51 void InputHandlerManager::AddInputHandler( | 54 void InputHandlerManager::AddInputHandler( |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 127 |
125 void InputHandlerManager::DidOverscroll(int routing_id, | 128 void InputHandlerManager::DidOverscroll(int routing_id, |
126 const DidOverscrollParams& params) { | 129 const DidOverscrollParams& params) { |
127 client_->DidOverscroll(routing_id, params); | 130 client_->DidOverscroll(routing_id, params); |
128 } | 131 } |
129 | 132 |
130 void InputHandlerManager::DidStopFlinging(int routing_id) { | 133 void InputHandlerManager::DidStopFlinging(int routing_id) { |
131 client_->DidStopFlinging(routing_id); | 134 client_->DidStopFlinging(routing_id); |
132 } | 135 } |
133 | 136 |
| 137 void InputHandlerManager::DidReceiveInputEvent( |
| 138 blink::WebInputEvent::Type type) { |
| 139 renderer_scheduler_->DidReceiveInputEventOnCompositorThread(type); |
| 140 } |
| 141 |
| 142 void InputHandlerManager::DidAnimateForInput() { |
| 143 renderer_scheduler_->DidAnimateForInputOnCompositorThread(); |
| 144 } |
| 145 |
134 } // namespace content | 146 } // namespace content |
OLD | NEW |