Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: content/renderer/input/input_event_filter.h

Issue 2813683002: Allow MainThreadEventQueue to call the RenderWidget directly. (Closed)
Patch Set: Fix style nits Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/idle_user_detector.cc ('k') | content/renderer/input/input_event_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_EVENT_FILTER_H_ 5 #ifndef CONTENT_RENDERER_INPUT_INPUT_EVENT_FILTER_H_
6 #define CONTENT_RENDERER_INPUT_INPUT_EVENT_FILTER_H_ 6 #define CONTENT_RENDERER_INPUT_INPUT_EVENT_FILTER_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <set> 9 #include <set>
10 #include <unordered_map> 10 #include <unordered_map>
(...skipping 24 matching lines...) Expand all
35 // based on routing_id (see AddRoute and RemoveRoute). 35 // based on routing_id (see AddRoute and RemoveRoute).
36 // 36 //
37 // The user of this class provides an instance of InputHandlerManager via 37 // The user of this class provides an instance of InputHandlerManager via
38 // |SetInputHandlerManager|. The InputHandlerManager's |HandleInputEvent| 38 // |SetInputHandlerManager|. The InputHandlerManager's |HandleInputEvent|
39 // will be called on the target thread to process the WebInputEvents. 39 // will be called on the target thread to process the WebInputEvents.
40 // 40 //
41 41
42 namespace content { 42 namespace content {
43 43
44 class CONTENT_EXPORT InputEventFilter : public InputHandlerManagerClient, 44 class CONTENT_EXPORT InputEventFilter : public InputHandlerManagerClient,
45 public IPC::MessageFilter, 45 public IPC::MessageFilter {
46 public MainThreadEventQueueClient {
47 public: 46 public:
48 InputEventFilter( 47 InputEventFilter(
49 const base::Callback<void(const IPC::Message&)>& main_listener, 48 const base::Callback<void(const IPC::Message&)>& main_listener,
50 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner, 49 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner,
51 const scoped_refptr<base::SingleThreadTaskRunner>& target_task_runner); 50 const scoped_refptr<base::SingleThreadTaskRunner>& target_task_runner);
52 51
53 // The |handler| is invoked on the thread associated with |target_loop| to 52 // The |handler| is invoked on the thread associated with |target_loop| to
54 // handle input events matching the filtered routes. 53 // handle input events matching the filtered routes.
55 // 54 //
56 // If INPUT_EVENT_ACK_STATE_NOT_CONSUMED is returned by the handler, 55 // If INPUT_EVENT_ACK_STATE_NOT_CONSUMED is returned by the handler,
57 // the original InputMsg_HandleInputEvent message will be delivered to 56 // the original InputMsg_HandleInputEvent message will be delivered to
58 // |main_listener| on the main thread. (The "main thread" in this context is 57 // |main_listener| on the main thread. (The "main thread" in this context is
59 // the thread where the InputEventFilter was constructed.) The responsibility 58 // the thread where the InputEventFilter was constructed.) The responsibility
60 // is left to the eventual handler to deliver the corresponding 59 // is left to the eventual handler to deliver the corresponding
61 // InputHostMsg_HandleInputEvent_ACK. 60 // InputHostMsg_HandleInputEvent_ACK.
62 // 61 //
63 void SetInputHandlerManager(InputHandlerManager*) override; 62 void SetInputHandlerManager(InputHandlerManager*) override;
64 void RegisterRoutingID(int routing_id) override; 63 void RegisterRoutingID(
64 int routing_id,
65 const scoped_refptr<MainThreadEventQueue>& input_event_queue) override;
65 void UnregisterRoutingID(int routing_id) override; 66 void UnregisterRoutingID(int routing_id) override;
66 void RegisterAssociatedRenderFrameRoutingID( 67 void RegisterAssociatedRenderFrameRoutingID(
67 int render_frame_routing_id, 68 int render_frame_routing_id,
68 int render_view_routing_id) override; 69 int render_view_routing_id) override;
69 void QueueClosureForMainThreadEventQueue( 70 void QueueClosureForMainThreadEventQueue(
70 int routing_id, 71 int routing_id,
71 const base::Closure& closure) override; 72 const base::Closure& closure) override;
72 void DidOverscroll(int routing_id, 73 void DidOverscroll(int routing_id,
73 const ui::DidOverscrollParams& params) override; 74 const ui::DidOverscrollParams& params) override;
74 void DidStopFlinging(int routing_id) override; 75 void DidStopFlinging(int routing_id) override;
75 void DispatchNonBlockingEventToMainThread( 76 void DispatchNonBlockingEventToMainThread(
76 int routing_id, 77 int routing_id,
77 ui::WebScopedInputEvent event, 78 ui::WebScopedInputEvent event,
78 const ui::LatencyInfo& latency_info) override; 79 const ui::LatencyInfo& latency_info) override;
79 80
80 void NotifyInputEventHandled(int routing_id,
81 blink::WebInputEvent::Type type,
82 blink::WebInputEventResult result,
83 InputEventAckState ack_result) override;
84 void ProcessRafAlignedInput(int routing_id,
85 base::TimeTicks frame_time) override;
86
87 // IPC::MessageFilter methods: 81 // IPC::MessageFilter methods:
88 void OnFilterAdded(IPC::Channel* channel) override; 82 void OnFilterAdded(IPC::Channel* channel) override;
89 void OnFilterRemoved() override; 83 void OnFilterRemoved() override;
90 void OnChannelClosing() override; 84 void OnChannelClosing() override;
91 bool OnMessageReceived(const IPC::Message& message) override; 85 bool OnMessageReceived(const IPC::Message& message) override;
92 86
93 // MainThreadEventQueueClient methods:
94 void HandleEventOnMainThread(int routing_id,
95 const blink::WebCoalescedInputEvent* event,
96 const ui::LatencyInfo& latency,
97 InputEventDispatchType dispatch_type) override;
98 // Send an InputEventAck IPC message. |touch_event_id| represents
99 // the unique event id for the original WebTouchEvent and should
100 // be 0 if otherwise. See WebInputEventTraits::GetUniqueTouchEventId.
101 void SendInputEventAck(int routing_id,
102 blink::WebInputEvent::Type type,
103 InputEventAckState ack_result,
104 uint32_t touch_event_id) override;
105
106 void NeedsMainFrame(int routing_id) override;
107
108 private: 87 private:
109 ~InputEventFilter() override; 88 ~InputEventFilter() override;
110 89
111 void ForwardToHandler(int routing_id, 90 void ForwardToHandler(int routing_id,
112 const IPC::Message& message, 91 const IPC::Message& message,
113 base::TimeTicks received_time); 92 base::TimeTicks received_time);
114 void DidForwardToHandlerAndOverscroll( 93 void DidForwardToHandlerAndOverscroll(
115 int routing_id, 94 int routing_id,
116 InputEventDispatchType dispatch_type, 95 InputEventDispatchType dispatch_type,
117 InputEventAckState ack_state, 96 InputEventAckState ack_state,
(...skipping 24 matching lines...) Expand all
142 121
143 using RouteQueueMap = 122 using RouteQueueMap =
144 std::unordered_map<int, scoped_refptr<MainThreadEventQueue>>; 123 std::unordered_map<int, scoped_refptr<MainThreadEventQueue>>;
145 // Maps RenderView routing ids to a MainThreadEventQueue. 124 // Maps RenderView routing ids to a MainThreadEventQueue.
146 RouteQueueMap route_queues_; 125 RouteQueueMap route_queues_;
147 126
148 using AssociatedRoutes = std::unordered_map<int, int>; 127 using AssociatedRoutes = std::unordered_map<int, int>;
149 // Maps RenderFrame routing ids to RenderView routing ids so that 128 // Maps RenderFrame routing ids to RenderView routing ids so that
150 // events sent down the two routing pipes can be handled synchronously. 129 // events sent down the two routing pipes can be handled synchronously.
151 AssociatedRoutes associated_routes_; 130 AssociatedRoutes associated_routes_;
152
153 blink::scheduler::RendererScheduler* renderer_scheduler_;
154 }; 131 };
155 132
156 } // namespace content 133 } // namespace content
157 134
158 #endif // CONTENT_RENDERER_INPUT_INPUT_EVENT_FILTER_H_ 135 #endif // CONTENT_RENDERER_INPUT_INPUT_EVENT_FILTER_H_
OLDNEW
« no previous file with comments | « content/renderer/idle_user_detector.cc ('k') | content/renderer/input/input_event_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698