| 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 #ifndef CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
| 6 #define CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 6 #define CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <unordered_map> | 8 #include <unordered_map> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 blink::WebInputEvent::Type, | 77 blink::WebInputEvent::Type, |
| 78 blink::WebInputEventResult, | 78 blink::WebInputEventResult, |
| 79 InputEventAckState); | 79 InputEventAckState); |
| 80 void ProcessRafAlignedInputOnMainThread(int routing_id); | 80 void ProcessRafAlignedInputOnMainThread(int routing_id); |
| 81 | 81 |
| 82 // Callback only from the compositor's thread. | 82 // Callback only from the compositor's thread. |
| 83 void RemoveInputHandler(int routing_id); | 83 void RemoveInputHandler(int routing_id); |
| 84 | 84 |
| 85 using InputEventAckStateCallback = | 85 using InputEventAckStateCallback = |
| 86 base::Callback<void(InputEventAckState, | 86 base::Callback<void(InputEventAckState, |
| 87 blink::WebScopedInputEvent, | 87 ui::WebScopedInputEvent, |
| 88 const ui::LatencyInfo&, | 88 const ui::LatencyInfo&, |
| 89 std::unique_ptr<ui::DidOverscrollParams>)>; | 89 std::unique_ptr<ui::DidOverscrollParams>)>; |
| 90 // Called from the compositor's thread. | 90 // Called from the compositor's thread. |
| 91 virtual void HandleInputEvent(int routing_id, | 91 virtual void HandleInputEvent(int routing_id, |
| 92 blink::WebScopedInputEvent input_event, | 92 ui::WebScopedInputEvent input_event, |
| 93 const ui::LatencyInfo& latency_info, | 93 const ui::LatencyInfo& latency_info, |
| 94 const InputEventAckStateCallback& callback); | 94 const InputEventAckStateCallback& callback); |
| 95 | 95 |
| 96 // Called from the compositor's thread. | 96 // Called from the compositor's thread. |
| 97 void DidOverscroll(int routing_id, const ui::DidOverscrollParams& params); | 97 void DidOverscroll(int routing_id, const ui::DidOverscrollParams& params); |
| 98 | 98 |
| 99 // Called from the compositor's thread. | 99 // Called from the compositor's thread. |
| 100 void DidStopFlinging(int routing_id); | 100 void DidStopFlinging(int routing_id); |
| 101 | 101 |
| 102 // Called from the compositor's thread. | 102 // Called from the compositor's thread. |
| 103 void DidAnimateForInput(); | 103 void DidAnimateForInput(); |
| 104 | 104 |
| 105 // Called from the compositor's thread. | 105 // Called from the compositor's thread. |
| 106 void NeedsMainFrame(int routing_id); | 106 void NeedsMainFrame(int routing_id); |
| 107 | 107 |
| 108 // Called from the compositor's thread. | 108 // Called from the compositor's thread. |
| 109 void DispatchNonBlockingEventToMainThread( | 109 void DispatchNonBlockingEventToMainThread( |
| 110 int routing_id, | 110 int routing_id, |
| 111 blink::WebScopedInputEvent event, | 111 ui::WebScopedInputEvent event, |
| 112 const ui::LatencyInfo& latency_info); | 112 const ui::LatencyInfo& latency_info); |
| 113 | 113 |
| 114 private: | 114 private: |
| 115 // Called from the compositor's thread. | 115 // Called from the compositor's thread. |
| 116 void AddInputHandlerOnCompositorThread( | 116 void AddInputHandlerOnCompositorThread( |
| 117 int routing_id, | 117 int routing_id, |
| 118 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner, | 118 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner, |
| 119 const base::WeakPtr<cc::InputHandler>& input_handler, | 119 const base::WeakPtr<cc::InputHandler>& input_handler, |
| 120 const base::WeakPtr<RenderWidget>& render_widget, | 120 const base::WeakPtr<RenderWidget>& render_widget, |
| 121 bool enable_smooth_scrolling); | 121 bool enable_smooth_scrolling); |
| 122 | 122 |
| 123 void RegisterRoutingIDOnCompositorThread(int routing_id); | 123 void RegisterRoutingIDOnCompositorThread(int routing_id); |
| 124 void UnregisterRoutingIDOnCompositorThread(int routing_id); | 124 void UnregisterRoutingIDOnCompositorThread(int routing_id); |
| 125 | 125 |
| 126 void ObserveWheelEventAndResultOnCompositorThread( | 126 void ObserveWheelEventAndResultOnCompositorThread( |
| 127 int routing_id, | 127 int routing_id, |
| 128 const blink::WebMouseWheelEvent& wheel_event, | 128 const blink::WebMouseWheelEvent& wheel_event, |
| 129 const cc::InputHandlerScrollResult& scroll_result); | 129 const cc::InputHandlerScrollResult& scroll_result); |
| 130 | 130 |
| 131 void ObserveGestureEventAndResultOnCompositorThread( | 131 void ObserveGestureEventAndResultOnCompositorThread( |
| 132 int routing_id, | 132 int routing_id, |
| 133 const blink::WebGestureEvent& gesture_event, | 133 const blink::WebGestureEvent& gesture_event, |
| 134 const cc::InputHandlerScrollResult& scroll_result); | 134 const cc::InputHandlerScrollResult& scroll_result); |
| 135 | 135 |
| 136 void DidHandleInputEventAndOverscroll( | 136 void DidHandleInputEventAndOverscroll( |
| 137 const InputEventAckStateCallback& callback, | 137 const InputEventAckStateCallback& callback, |
| 138 ui::InputHandlerProxy::EventDisposition event_disposition, | 138 ui::InputHandlerProxy::EventDisposition event_disposition, |
| 139 blink::WebScopedInputEvent input_event, | 139 ui::WebScopedInputEvent input_event, |
| 140 const ui::LatencyInfo& latency_info, | 140 const ui::LatencyInfo& latency_info, |
| 141 std::unique_ptr<ui::DidOverscrollParams> overscroll_params); | 141 std::unique_ptr<ui::DidOverscrollParams> overscroll_params); |
| 142 | 142 |
| 143 using InputHandlerMap = | 143 using InputHandlerMap = |
| 144 std::unordered_map<int, // routing_id | 144 std::unordered_map<int, // routing_id |
| 145 std::unique_ptr<InputHandlerWrapper>>; | 145 std::unique_ptr<InputHandlerWrapper>>; |
| 146 InputHandlerMap input_handlers_; | 146 InputHandlerMap input_handlers_; |
| 147 | 147 |
| 148 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 148 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 149 InputHandlerManagerClient* const client_; | 149 InputHandlerManagerClient* const client_; |
| 150 // May be null. | 150 // May be null. |
| 151 SynchronousInputHandlerProxyClient* const synchronous_handler_proxy_client_; | 151 SynchronousInputHandlerProxyClient* const synchronous_handler_proxy_client_; |
| 152 blink::scheduler::RendererScheduler* const renderer_scheduler_; // Not owned. | 152 blink::scheduler::RendererScheduler* const renderer_scheduler_; // Not owned. |
| 153 | 153 |
| 154 base::WeakPtrFactory<InputHandlerManager> weak_ptr_factory_; | 154 base::WeakPtrFactory<InputHandlerManager> weak_ptr_factory_; |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 } // namespace content | 157 } // namespace content |
| 158 | 158 |
| 159 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 159 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
| OLD | NEW |