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

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

Issue 16114003: Don't send touch move to renderer while scrolling (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: tests added 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_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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 // Empties the queue of touch events. This may result in any number of gesture 54 // Empties the queue of touch events. This may result in any number of gesture
55 // events being sent to the renderer. 55 // events being sent to the renderer.
56 void FlushQueue(); 56 void FlushQueue();
57 57
58 // Returns whether the event-queue is empty. 58 // Returns whether the event-queue is empty.
59 bool empty() const WARN_UNUSED_RESULT { 59 bool empty() const WARN_UNUSED_RESULT {
60 return touch_queue_.empty(); 60 return touch_queue_.empty();
61 } 61 }
62 62
63 void set_no_touch_move_to_renderer(bool value) {
64 no_touch_move_to_renderer_ = value;
65 }
66
63 private: 67 private:
64 friend class MockRenderWidgetHost; 68 friend class MockRenderWidgetHost;
65 friend class ImmediateInputRouterTest; 69 friend class ImmediateInputRouterTest;
66 70
67 CONTENT_EXPORT size_t GetQueueSize() const; 71 CONTENT_EXPORT size_t GetQueueSize() const;
68 CONTENT_EXPORT const TouchEventWithLatencyInfo& GetLatestEvent() const; 72 CONTENT_EXPORT const TouchEventWithLatencyInfo& GetLatestEvent() const;
69 73
70 // Pops the touch-event from the top of the queue and sends it to the 74 // Pops the touch-event from the top of the queue and sends it to the
71 // TouchEventQueueClient. This reduces the size of the queue by one. 75 // TouchEventQueueClient. This reduces the size of the queue by one.
72 void PopTouchEventWithAck(InputEventAckState ack_result); 76 void PopTouchEventWithAck(InputEventAckState ack_result);
73 77
74 bool ShouldForwardToRenderer(const WebKit::WebTouchEvent& event) const; 78 bool ShouldForwardToRenderer(const WebKit::WebTouchEvent& event) const;
75 79
76 // Handles touch event forwarding and ack'ed event dispatch. 80 // Handles touch event forwarding and ack'ed event dispatch.
77 TouchEventQueueClient* client_; 81 TouchEventQueueClient* client_;
78 82
79 typedef std::deque<CoalescedWebTouchEvent*> TouchQueue; 83 typedef std::deque<CoalescedWebTouchEvent*> TouchQueue;
80 TouchQueue touch_queue_; 84 TouchQueue touch_queue_;
81 85
82 // Maintain the ACK status for each touch point. 86 // Maintain the ACK status for each touch point.
83 typedef std::map<int, InputEventAckState> TouchPointAckStates; 87 typedef std::map<int, InputEventAckState> TouchPointAckStates;
84 TouchPointAckStates touch_ack_states_; 88 TouchPointAckStates touch_ack_states_;
85 89
86 // Used to defer touch forwarding when ack dispatch triggers |QueueEvent()|. 90 // Used to defer touch forwarding when ack dispatch triggers |QueueEvent()|.
87 bool dispatching_touch_ack_; 91 bool dispatching_touch_ack_;
88 92
93 // Don't send touch move events to renderer. This is enabled when the page
94 // is scrolling.
sadrul 2013/08/13 19:40:04 + "This behaviour is currently enabled only on aur
Yufeng Shen (Slow to review) 2013/08/13 20:17:27 Done.
95 bool no_touch_move_to_renderer_;
96
89 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); 97 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue);
90 }; 98 };
91 99
92 } // namespace content 100 } // namespace content
93 101
94 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ 102 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698