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

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

Issue 2765583002: Teach main thread event queue about closures. (Closed)
Patch Set: Fix Mac issue 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
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // If INPUT_EVENT_ACK_STATE_NOT_CONSUMED is returned by the handler, 56 // If INPUT_EVENT_ACK_STATE_NOT_CONSUMED is returned by the handler,
57 // the original InputMsg_HandleInputEvent message will be delivered to 57 // the original InputMsg_HandleInputEvent message will be delivered to
58 // |main_listener| on the main thread. (The "main thread" in this context is 58 // |main_listener| on the main thread. (The "main thread" in this context is
59 // the thread where the InputEventFilter was constructed.) The responsibility 59 // the thread where the InputEventFilter was constructed.) The responsibility
60 // is left to the eventual handler to deliver the corresponding 60 // is left to the eventual handler to deliver the corresponding
61 // InputHostMsg_HandleInputEvent_ACK. 61 // InputHostMsg_HandleInputEvent_ACK.
62 // 62 //
63 void SetInputHandlerManager(InputHandlerManager*) override; 63 void SetInputHandlerManager(InputHandlerManager*) override;
64 void RegisterRoutingID(int routing_id) override; 64 void RegisterRoutingID(int routing_id) override;
65 void UnregisterRoutingID(int routing_id) override; 65 void UnregisterRoutingID(int routing_id) override;
66 void AssociateRenderFrameRoutingID(int render_frame_routing_id,
67 int render_view_routing_id) override;
68 void QueueClosureForMainThreadEventQueue(
69 int routing_id,
70 const base::Closure& closure) override;
66 void DidOverscroll(int routing_id, 71 void DidOverscroll(int routing_id,
67 const ui::DidOverscrollParams& params) override; 72 const ui::DidOverscrollParams& params) override;
68 void DidStopFlinging(int routing_id) override; 73 void DidStopFlinging(int routing_id) override;
69 void DispatchNonBlockingEventToMainThread( 74 void DispatchNonBlockingEventToMainThread(
70 int routing_id, 75 int routing_id,
71 ui::WebScopedInputEvent event, 76 ui::WebScopedInputEvent event,
72 const ui::LatencyInfo& latency_info) override; 77 const ui::LatencyInfo& latency_info) override;
73 78
74 void NotifyInputEventHandled(int routing_id, 79 void NotifyInputEventHandled(int routing_id,
75 blink::WebInputEvent::Type type, 80 blink::WebInputEvent::Type type,
(...skipping 19 matching lines...) Expand all
95 void SendInputEventAck(int routing_id, 100 void SendInputEventAck(int routing_id,
96 blink::WebInputEvent::Type type, 101 blink::WebInputEvent::Type type,
97 InputEventAckState ack_result, 102 InputEventAckState ack_result,
98 uint32_t touch_event_id) override; 103 uint32_t touch_event_id) override;
99 104
100 void NeedsMainFrame(int routing_id) override; 105 void NeedsMainFrame(int routing_id) override;
101 106
102 private: 107 private:
103 ~InputEventFilter() override; 108 ~InputEventFilter() override;
104 109
105 void ForwardToHandler(const IPC::Message& message, 110 void ForwardToHandler(int routing_id,
111 const IPC::Message& message,
106 base::TimeTicks received_time); 112 base::TimeTicks received_time);
107 void DidForwardToHandlerAndOverscroll( 113 void DidForwardToHandlerAndOverscroll(
108 int routing_id, 114 int routing_id,
109 InputEventDispatchType dispatch_type, 115 InputEventDispatchType dispatch_type,
110 InputEventAckState ack_state, 116 InputEventAckState ack_state,
111 ui::WebScopedInputEvent event, 117 ui::WebScopedInputEvent event,
112 const ui::LatencyInfo& latency_info, 118 const ui::LatencyInfo& latency_info,
113 std::unique_ptr<ui::DidOverscrollParams> overscroll_params); 119 std::unique_ptr<ui::DidOverscrollParams> overscroll_params);
114 void SendMessage(std::unique_ptr<IPC::Message> message); 120 void SendMessage(std::unique_ptr<IPC::Message> message);
115 void SendMessageOnIOThread(std::unique_ptr<IPC::Message> message); 121 void SendMessageOnIOThread(std::unique_ptr<IPC::Message> message);
(...skipping 13 matching lines...) Expand all
129 // Protects access to routes_. 135 // Protects access to routes_.
130 base::Lock routes_lock_; 136 base::Lock routes_lock_;
131 137
132 // Indicates the routing_ids for which input events should be filtered. 138 // Indicates the routing_ids for which input events should be filtered.
133 std::set<int> routes_; 139 std::set<int> routes_;
134 140
135 using RouteQueueMap = 141 using RouteQueueMap =
136 std::unordered_map<int, scoped_refptr<MainThreadEventQueue>>; 142 std::unordered_map<int, scoped_refptr<MainThreadEventQueue>>;
137 RouteQueueMap route_queues_; 143 RouteQueueMap route_queues_;
138 144
145 using AssociatedRoutes = std::unordered_map<int, int>;
146 AssociatedRoutes associated_routes_;
147
139 blink::scheduler::RendererScheduler* renderer_scheduler_; 148 blink::scheduler::RendererScheduler* renderer_scheduler_;
140 }; 149 };
141 150
142 } // namespace content 151 } // namespace content
143 152
144 #endif // CONTENT_RENDERER_INPUT_INPUT_EVENT_FILTER_H_ 153 #endif // CONTENT_RENDERER_INPUT_INPUT_EVENT_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698