Chromium Code Reviews| 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_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 
| 7 | 7 | 
| 8 #include <deque> | 8 #include <deque> | 
| 9 #include <map> | 9 #include <map> | 
| 10 | 10 | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 // single touch-move event). The event may also be immediately forwarded to | 45 // single touch-move event). The event may also be immediately forwarded to | 
| 46 // the renderer (e.g. when there are no other queued touch event). | 46 // the renderer (e.g. when there are no other queued touch event). | 
| 47 void QueueEvent(const TouchEventWithLatencyInfo& event); | 47 void QueueEvent(const TouchEventWithLatencyInfo& event); | 
| 48 | 48 | 
| 49 // Notifies the queue that a touch-event has been processed by the renderer. | 49 // Notifies the queue that a touch-event has been processed by the renderer. | 
| 50 // At this point, the queue may send one or more gesture events and/or | 50 // At this point, the queue may send one or more gesture events and/or | 
| 51 // additional queued touch-events to the renderer. | 51 // additional queued touch-events to the renderer. | 
| 52 void ProcessTouchAck(InputEventAckState ack_result, | 52 void ProcessTouchAck(InputEventAckState ack_result, | 
| 53 const ui::LatencyInfo& latency_info); | 53 const ui::LatencyInfo& latency_info); | 
| 54 | 54 | 
| 55 void OnGestureScrollEvent(const GestureEventWithLatencyInfo& gesture_event); | |
| 
 
sadrul
2013/09/27 15:13:51
doc
 
Yufeng Shen (Slow to review)
2013/09/30 20:43:14
Done.
 
 | |
| 56 | |
| 55 // Empties the queue of touch events. This may result in any number of gesture | 57 // Empties the queue of touch events. This may result in any number of gesture | 
| 56 // events being sent to the renderer. | 58 // events being sent to the renderer. | 
| 57 void FlushQueue(); | 59 void FlushQueue(); | 
| 58 | 60 | 
| 59 // Returns whether the event-queue is empty. | 61 // Returns whether the event-queue is empty. | 
| 60 bool empty() const WARN_UNUSED_RESULT { | 62 bool empty() const WARN_UNUSED_RESULT { | 
| 61 return touch_queue_.empty(); | 63 return touch_queue_.empty(); | 
| 62 } | 64 } | 
| 63 | 65 | 
| 64 void set_no_touch_move_to_renderer(bool value) { | |
| 65 no_touch_move_to_renderer_ = value; | |
| 66 } | |
| 67 | |
| 68 private: | 66 private: | 
| 69 friend class MockRenderWidgetHost; | 67 friend class MockRenderWidgetHost; | 
| 70 friend class ImmediateInputRouterTest; | 68 friend class ImmediateInputRouterTest; | 
| 71 | 69 | 
| 72 CONTENT_EXPORT size_t GetQueueSize() const; | 70 CONTENT_EXPORT size_t GetQueueSize() const; | 
| 73 CONTENT_EXPORT const TouchEventWithLatencyInfo& GetLatestEvent() const; | 71 CONTENT_EXPORT const TouchEventWithLatencyInfo& GetLatestEvent() const; | 
| 74 | 72 | 
| 75 // Walks the queue, checking each event for |ShouldForwardToRenderer()|. | 73 // Walks the queue, checking each event for |ShouldForwardToRenderer()|. | 
| 76 // If true, forwards the touch event and stops processing further events. | 74 // If true, forwards the touch event and stops processing further events. | 
| 77 // If false, acks the event with |INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS|. | 75 // If false, acks the event with |INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS|. | 
| (...skipping 10 matching lines...) Expand all Loading... | |
| 88 TouchEventQueueClient* client_; | 86 TouchEventQueueClient* client_; | 
| 89 | 87 | 
| 90 typedef std::deque<CoalescedWebTouchEvent*> TouchQueue; | 88 typedef std::deque<CoalescedWebTouchEvent*> TouchQueue; | 
| 91 TouchQueue touch_queue_; | 89 TouchQueue touch_queue_; | 
| 92 | 90 | 
| 93 // Maintain the ACK status for each touch point. | 91 // Maintain the ACK status for each touch point. | 
| 94 typedef std::map<int, InputEventAckState> TouchPointAckStates; | 92 typedef std::map<int, InputEventAckState> TouchPointAckStates; | 
| 95 TouchPointAckStates touch_ack_states_; | 93 TouchPointAckStates touch_ack_states_; | 
| 96 | 94 | 
| 97 // Used to defer touch forwarding when ack dispatch triggers |QueueEvent()|. | 95 // Used to defer touch forwarding when ack dispatch triggers |QueueEvent()|. | 
| 98 bool dispatching_touch_ack_; | 96 // If not NULL, |dispatching_touch_ack_| is the touch event of which the ack | 
| 97 // is being dispatched. | |
| 98 CoalescedWebTouchEvent* dispatching_touch_ack_; | |
| 99 | 99 | 
| 100 // Don't send touch move events to renderer. This is enabled when the page | 100 // Don't send touch events to renderer. This is enabled when the page | 
| 101 // is scrolling. This behaviour is currently enabled only on aura behind a | 101 // is scrolling. This behaviour is currently enabled only on aura behind | 
| 102 // flag. | 102 // a flag. | 
| 103 bool no_touch_move_to_renderer_; | 103 bool no_touch_to_renderer_; | 
| 104 | 104 | 
| 105 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); | 105 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); | 
| 106 }; | 106 }; | 
| 107 | 107 | 
| 108 } // namespace content | 108 } // namespace content | 
| 109 | 109 | 
| 110 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 110 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 
| OLD | NEW |