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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Walks the queue, checking each event for |ShouldForwardToRenderer()|. | 80 // Walks the queue, checking each event for |ShouldForwardToRenderer()|. |
81 // If true, forwards the touch event and stops processing further events. | 81 // If true, forwards the touch event and stops processing further events. |
82 // If false, acks the event with |INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS|. | 82 // If false, acks the event with |INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS|. |
83 void TryForwardNextEventToRenderer(); | 83 void TryForwardNextEventToRenderer(); |
84 | 84 |
85 // Pops the touch-event from the top of the queue and sends it to the | 85 // Pops the touch-event from the top of the queue and sends it to the |
86 // TouchEventQueueClient. This reduces the size of the queue by one. | 86 // TouchEventQueueClient. This reduces the size of the queue by one. |
87 void PopTouchEventToClient(InputEventAckState ack_result, | 87 void PopTouchEventToClient(InputEventAckState ack_result, |
88 const ui::LatencyInfo& renderer_latency_info); | 88 const ui::LatencyInfo& renderer_latency_info); |
89 | 89 |
90 bool ShouldForwardToRenderer(const WebKit::WebTouchEvent& event) const; | 90 bool ShouldForwardToRenderer(const blink::WebTouchEvent& event) const; |
91 | 91 |
92 // Handles touch event forwarding and ack'ed event dispatch. | 92 // Handles touch event forwarding and ack'ed event dispatch. |
93 TouchEventQueueClient* client_; | 93 TouchEventQueueClient* client_; |
94 | 94 |
95 typedef std::deque<CoalescedWebTouchEvent*> TouchQueue; | 95 typedef std::deque<CoalescedWebTouchEvent*> TouchQueue; |
96 TouchQueue touch_queue_; | 96 TouchQueue touch_queue_; |
97 | 97 |
98 // Maintain the ACK status for each touch point. | 98 // Maintain the ACK status for each touch point. |
99 typedef std::map<int, InputEventAckState> TouchPointAckStates; | 99 typedef std::map<int, InputEventAckState> TouchPointAckStates; |
100 TouchPointAckStates touch_ack_states_; | 100 TouchPointAckStates touch_ack_states_; |
101 | 101 |
102 // Used to defer touch forwarding when ack dispatch triggers |QueueEvent()|. | 102 // Used to defer touch forwarding when ack dispatch triggers |QueueEvent()|. |
103 // If not NULL, |dispatching_touch_ack_| is the touch event of which the ack | 103 // If not NULL, |dispatching_touch_ack_| is the touch event of which the ack |
104 // is being dispatched. | 104 // is being dispatched. |
105 CoalescedWebTouchEvent* dispatching_touch_ack_; | 105 CoalescedWebTouchEvent* dispatching_touch_ack_; |
106 | 106 |
107 // Don't send touch events to renderer. This is enabled when the page | 107 // Don't send touch events to renderer. This is enabled when the page |
108 // is scrolling. This behaviour is currently enabled only on aura behind | 108 // is scrolling. This behaviour is currently enabled only on aura behind |
109 // a flag. | 109 // a flag. |
110 bool no_touch_to_renderer_; | 110 bool no_touch_to_renderer_; |
111 | 111 |
112 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); | 112 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); |
113 }; | 113 }; |
114 | 114 |
115 } // namespace content | 115 } // namespace content |
116 | 116 |
117 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 117 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ |
OLD | NEW |