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

Side by Side Diff: content/browser/renderer_host/input/immediate_input_router.h

Issue 20356003: Provided batched input delivery with a BufferedInputRouter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review Created 7 years, 4 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_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "content/browser/renderer_host/input/input_router.h" 13 #include "content/browser/renderer_host/input/input_router.h"
14 #include "content/browser/renderer_host/input/touch_event_queue.h" 14 #include "content/browser/renderer_host/input/touch_event_queue.h"
15 #include "content/public/browser/native_web_keyboard_event.h" 15 #include "content/public/browser/native_web_keyboard_event.h"
16 16
17 namespace ui { 17 namespace ui {
18 struct LatencyInfo; 18 struct LatencyInfo;
19 } 19 }
20 20
21 namespace content { 21 namespace content {
22 22
23 class GestureEventFilter; 23 class GestureEventFilter;
24 class InputAckHandler;
24 class InputRouterClient; 25 class InputRouterClient;
25 class RenderProcessHost; 26 class RenderProcessHost;
26 class RenderWidgetHostImpl; 27 class RenderWidgetHostImpl;
27 28
28 // A default implementation for browser input event routing. Input commands are 29 // A default implementation for browser input event routing. Input commands are
29 // forwarded to the renderer immediately upon receipt. 30 // forwarded to the renderer immediately upon receipt.
30 class CONTENT_EXPORT ImmediateInputRouter 31 class CONTENT_EXPORT ImmediateInputRouter
31 : public NON_EXPORTED_BASE(InputRouter), 32 : public NON_EXPORTED_BASE(InputRouter),
32 public NON_EXPORTED_BASE(TouchEventQueueClient) { 33 public NON_EXPORTED_BASE(TouchEventQueueClient) {
33 public: 34 public:
34 ImmediateInputRouter(RenderProcessHost* process, 35 ImmediateInputRouter(RenderProcessHost* process,
35 InputRouterClient* client, 36 InputRouterClient* client,
37 InputAckHandler* ack_handler,
36 int routing_id); 38 int routing_id);
37 virtual ~ImmediateInputRouter(); 39 virtual ~ImmediateInputRouter();
38 40
39 // InputRouter 41 // InputRouter
40 virtual bool SendInput(IPC::Message* message) OVERRIDE; 42 virtual void Flush() OVERRIDE;
43 virtual bool SendInput(scoped_ptr<IPC::Message> message) OVERRIDE;
41 virtual void SendMouseEvent( 44 virtual void SendMouseEvent(
42 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE; 45 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE;
43 virtual void SendWheelEvent( 46 virtual void SendWheelEvent(
44 const MouseWheelEventWithLatencyInfo& wheel_event) OVERRIDE; 47 const MouseWheelEventWithLatencyInfo& wheel_event) OVERRIDE;
45 virtual void SendKeyboardEvent( 48 virtual void SendKeyboardEvent(
46 const NativeWebKeyboardEvent& key_event, 49 const NativeWebKeyboardEvent& key_event,
47 const ui::LatencyInfo& latency_info) OVERRIDE; 50 const ui::LatencyInfo& latency_info) OVERRIDE;
48 virtual void SendGestureEvent( 51 virtual void SendGestureEvent(
49 const GestureEventWithLatencyInfo& gesture_event) OVERRIDE; 52 const GestureEventWithLatencyInfo& gesture_event) OVERRIDE;
50 virtual void SendTouchEvent( 53 virtual void SendTouchEvent(
(...skipping 19 matching lines...) Expand all
70 73
71 TouchEventQueue* touch_event_queue() { 74 TouchEventQueue* touch_event_queue() {
72 return touch_event_queue_.get(); 75 return touch_event_queue_.get();
73 } 76 }
74 77
75 private: 78 private:
76 // TouchEventQueueClient 79 // TouchEventQueueClient
77 virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, 80 virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event,
78 InputEventAckState ack_result) OVERRIDE; 81 InputEventAckState ack_result) OVERRIDE;
79 82
80 bool SendMoveCaret(IPC::Message* message); 83 bool SendMoveCaret(scoped_ptr<IPC::Message> message);
81 bool SendSelectRange(IPC::Message* message); 84 bool SendSelectRange(scoped_ptr<IPC::Message> message);
82 bool Send(IPC::Message* message); 85 bool Send(IPC::Message* message);
83 86
84 // Transmits the given input event an as an IPC::Message. This is an internal 87 // Transmits the given input event an as an IPC::Message. This is an internal
85 // helper for |FilterAndSendInputEvent()| and should not be used otherwise. 88 // helper for |FilterAndSendInputEvent()| and should not be used otherwise.
86 void SendWebInputEvent(const WebKit::WebInputEvent& input_event, 89 void SendWebInputEvent(const WebKit::WebInputEvent& input_event,
87 const ui::LatencyInfo& latency_info, 90 const ui::LatencyInfo& latency_info,
88 bool is_keyboard_shortcut); 91 bool is_keyboard_shortcut);
89 92
90 // Filters and forwards the given WebInputEvent to |SendWebInputEvent()|. This 93 // Filters and forwards the given WebInputEvent to |SendWebInputEvent()|. This
91 // is an internal helper for |Send*Event()| and should not be used otherwise. 94 // is an internal helper for |Send*Event()| and should not be used otherwise.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // This can result in a gesture event being generated and sent back to the 128 // This can result in a gesture event being generated and sent back to the
126 // renderer. 129 // renderer.
127 void ProcessTouchAck(InputEventAckState ack_result, 130 void ProcessTouchAck(InputEventAckState ack_result,
128 const ui::LatencyInfo& latency_info); 131 const ui::LatencyInfo& latency_info);
129 132
130 int routing_id() const { return routing_id_; } 133 int routing_id() const { return routing_id_; }
131 134
132 135
133 RenderProcessHost* process_; 136 RenderProcessHost* process_;
134 InputRouterClient* client_; 137 InputRouterClient* client_;
138 InputAckHandler* ack_handler_;
135 int routing_id_; 139 int routing_id_;
136 140
137 // (Similar to |mouse_move_pending_|.) True while waiting for SelectRange_ACK. 141 // (Similar to |mouse_move_pending_|.) True while waiting for SelectRange_ACK.
138 bool select_range_pending_; 142 bool select_range_pending_;
139 143
140 // (Similar to |next_mouse_move_|.) The next SelectRange to send, if any. 144 // (Similar to |next_mouse_move_|.) The next SelectRange to send, if any.
141 scoped_ptr<IPC::Message> next_selection_range_; 145 scoped_ptr<IPC::Message> next_selection_range_;
142 146
143 // (Similar to |mouse_move_pending_|.) True while waiting for MoveCaret_ACK. 147 // (Similar to |mouse_move_pending_|.) True while waiting for MoveCaret_ACK.
144 bool move_caret_pending_; 148 bool move_caret_pending_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 192
189 scoped_ptr<TouchEventQueue> touch_event_queue_; 193 scoped_ptr<TouchEventQueue> touch_event_queue_;
190 scoped_ptr<GestureEventFilter> gesture_event_filter_; 194 scoped_ptr<GestureEventFilter> gesture_event_filter_;
191 195
192 DISALLOW_COPY_AND_ASSIGN(ImmediateInputRouter); 196 DISALLOW_COPY_AND_ASSIGN(ImmediateInputRouter);
193 }; 197 };
194 198
195 } // namespace content 199 } // namespace content
196 200
197 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ 201 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698