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

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

Issue 2479023003: Remove is_fling flag for fling intervention (Closed)
Patch Set: Rename ack state Created 4 years, 1 month 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 #include "content/renderer/input/input_event_filter.h" 5 #include "content/renderer/input/input_event_filter.h"
6 6
7 #include <tuple> 7 #include <tuple>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 renderer_scheduler_ = 64 renderer_scheduler_ =
65 render_thread_impl ? render_thread_impl->GetRendererScheduler() : nullptr; 65 render_thread_impl ? render_thread_impl->GetRendererScheduler() : nullptr;
66 } 66 }
67 67
68 void InputEventFilter::SetInputHandlerManager( 68 void InputEventFilter::SetInputHandlerManager(
69 InputHandlerManager* input_handler_manager) { 69 InputHandlerManager* input_handler_manager) {
70 DCHECK(main_task_runner_->BelongsToCurrentThread()); 70 DCHECK(main_task_runner_->BelongsToCurrentThread());
71 input_handler_manager_ = input_handler_manager; 71 input_handler_manager_ = input_handler_manager;
72 } 72 }
73 73
74 void InputEventFilter::SetIsFlingingInMainThreadEventQueue(int routing_id,
75 bool is_flinging) {
76 RouteQueueMap::iterator iter = route_queues_.find(routing_id);
77 if (iter == route_queues_.end() || !iter->second)
78 return;
79
80 iter->second->set_is_flinging(is_flinging);
81 }
82
83 void InputEventFilter::RegisterRoutingID(int routing_id) { 74 void InputEventFilter::RegisterRoutingID(int routing_id) {
84 base::AutoLock locked(routes_lock_); 75 base::AutoLock locked(routes_lock_);
85 routes_.insert(routing_id); 76 routes_.insert(routing_id);
86 route_queues_[routing_id] = new MainThreadEventQueue( 77 route_queues_[routing_id] = new MainThreadEventQueue(
87 routing_id, this, main_task_runner_, renderer_scheduler_); 78 routing_id, this, main_task_runner_, renderer_scheduler_);
88 } 79 }
89 80
90 void InputEventFilter::UnregisterRoutingID(int routing_id) { 81 void InputEventFilter::UnregisterRoutingID(int routing_id) {
91 base::AutoLock locked(routes_lock_); 82 base::AutoLock locked(routes_lock_);
92 routes_.erase(routing_id); 83 routes_.erase(routing_id);
93 route_queues_.erase(routing_id); 84 route_queues_.erase(routing_id);
94 } 85 }
95 86
96 void InputEventFilter::DidOverscroll(int routing_id, 87 void InputEventFilter::DidOverscroll(int routing_id,
97 const DidOverscrollParams& params) { 88 const DidOverscrollParams& params) {
98 SendMessage(std::unique_ptr<IPC::Message>( 89 SendMessage(std::unique_ptr<IPC::Message>(
99 new InputHostMsg_DidOverscroll(routing_id, params))); 90 new InputHostMsg_DidOverscroll(routing_id, params)));
100 } 91 }
101 92
102 void InputEventFilter::DidStartFlinging(int routing_id) {
103 SetIsFlingingInMainThreadEventQueue(routing_id, true);
104 }
105
106 void InputEventFilter::DidStopFlinging(int routing_id) { 93 void InputEventFilter::DidStopFlinging(int routing_id) {
107 SetIsFlingingInMainThreadEventQueue(routing_id, false);
108 SendMessage(base::MakeUnique<InputHostMsg_DidStopFlinging>(routing_id)); 94 SendMessage(base::MakeUnique<InputHostMsg_DidStopFlinging>(routing_id));
109 } 95 }
110 96
111 void InputEventFilter::DispatchNonBlockingEventToMainThread( 97 void InputEventFilter::DispatchNonBlockingEventToMainThread(
112 int routing_id, 98 int routing_id,
113 ui::ScopedWebInputEvent event, 99 ui::ScopedWebInputEvent event,
114 const ui::LatencyInfo& latency_info) { 100 const ui::LatencyInfo& latency_info) {
115 DCHECK(target_task_runner_->BelongsToCurrentThread()); 101 DCHECK(target_task_runner_->BelongsToCurrentThread());
116 RouteQueueMap::iterator iter = route_queues_.find(routing_id); 102 RouteQueueMap::iterator iter = route_queues_.find(routing_id);
117 if (iter != route_queues_.end()) { 103 if (iter != route_queues_.end()) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 InputEventAckState ack_state, 230 InputEventAckState ack_state,
245 ui::ScopedWebInputEvent event, 231 ui::ScopedWebInputEvent event,
246 const ui::LatencyInfo& latency_info, 232 const ui::LatencyInfo& latency_info,
247 std::unique_ptr<DidOverscrollParams> overscroll_params) { 233 std::unique_ptr<DidOverscrollParams> overscroll_params) {
248 bool send_ack = dispatch_type == DISPATCH_TYPE_BLOCKING; 234 bool send_ack = dispatch_type == DISPATCH_TYPE_BLOCKING;
249 uint32_t unique_touch_event_id = 235 uint32_t unique_touch_event_id =
250 ui::WebInputEventTraits::GetUniqueTouchEventId(*event); 236 ui::WebInputEventTraits::GetUniqueTouchEventId(*event);
251 WebInputEvent::Type type = event->type; 237 WebInputEvent::Type type = event->type;
252 238
253 if (ack_state == INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING || 239 if (ack_state == INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING ||
254 ack_state == INPUT_EVENT_ACK_STATE_NOT_CONSUMED) { 240 ack_state == INPUT_EVENT_ACK_STATE_NOT_CONSUMED ||
241 ack_state == INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING_DUE_TO_FLING) {
tdresser 2016/11/07 21:58:49 Nit: might be nice to reorder these such that the
lanwei 2016/11/07 23:25:18 Done.
255 DCHECK(!overscroll_params); 242 DCHECK(!overscroll_params);
256 RouteQueueMap::iterator iter = route_queues_.find(routing_id); 243 RouteQueueMap::iterator iter = route_queues_.find(routing_id);
257 if (iter != route_queues_.end()) { 244 if (iter != route_queues_.end()) {
258 send_ack &= iter->second->HandleEvent(std::move(event), latency_info, 245 send_ack &= iter->second->HandleEvent(std::move(event), latency_info,
259 dispatch_type, ack_state); 246 dispatch_type, ack_state);
260 } 247 }
261 } 248 }
262 event.reset(); 249 event.reset();
263 250
264 if (!send_ack) 251 if (!send_ack)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 input_handler_manager_->NeedsMainFrame(routing_id); 299 input_handler_manager_->NeedsMainFrame(routing_id);
313 return; 300 return;
314 } 301 }
315 302
316 target_task_runner_->PostTask( 303 target_task_runner_->PostTask(
317 FROM_HERE, 304 FROM_HERE,
318 base::Bind(&InputEventFilter::NeedsMainFrame, this, routing_id)); 305 base::Bind(&InputEventFilter::NeedsMainFrame, this, routing_id));
319 } 306 }
320 307
321 } // namespace content 308 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698