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