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

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

Issue 2621303004: Keep track of coalesced events in main thread event queue (Closed)
Patch Set: Improve MainThreadEventQueue unittests Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/render_widget_input_handler.h" 5 #include "content/renderer/input/render_widget_input_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 context_menu_source_type_(ui::MENU_SOURCE_MOUSE), 198 context_menu_source_type_(ui::MENU_SOURCE_MOUSE),
199 suppress_next_char_events_(false) { 199 suppress_next_char_events_(false) {
200 DCHECK(delegate); 200 DCHECK(delegate);
201 DCHECK(widget); 201 DCHECK(widget);
202 delegate->SetInputHandler(this); 202 delegate->SetInputHandler(this);
203 } 203 }
204 204
205 RenderWidgetInputHandler::~RenderWidgetInputHandler() {} 205 RenderWidgetInputHandler::~RenderWidgetInputHandler() {}
206 206
207 void RenderWidgetInputHandler::HandleInputEvent( 207 void RenderWidgetInputHandler::HandleInputEvent(
208 const WebInputEvent& input_event, 208 const blink::WebCoalescedInputEvent& coalesced_event,
209 const ui::LatencyInfo& latency_info, 209 const ui::LatencyInfo& latency_info,
210 InputEventDispatchType dispatch_type) { 210 InputEventDispatchType dispatch_type) {
211 const WebInputEvent& input_event = coalesced_event.event();
211 base::AutoReset<bool> handling_input_event_resetter(&handling_input_event_, 212 base::AutoReset<bool> handling_input_event_resetter(&handling_input_event_,
212 true); 213 true);
213 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( 214 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter(
214 &handling_event_type_, input_event.type()); 215 &handling_event_type_, input_event.type());
215 216
216 // Calls into |didOverscroll()| while handling this event will populate 217 // Calls into |didOverscroll()| while handling this event will populate
217 // |event_overscroll|, which in turn will be bundled with the event ack. 218 // |event_overscroll|, which in turn will be bundled with the event ack.
218 std::unique_ptr<DidOverscrollParams> event_overscroll; 219 std::unique_ptr<DidOverscrollParams> event_overscroll;
219 base::AutoReset<std::unique_ptr<DidOverscrollParams>*> 220 base::AutoReset<std::unique_ptr<DidOverscrollParams>*>
220 handling_event_overscroll_resetter(&handling_event_overscroll_, 221 handling_event_overscroll_resetter(&handling_event_overscroll_,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 prevent_default || delegate_->WillHandleGestureEvent(gesture_event); 300 prevent_default || delegate_->WillHandleGestureEvent(gesture_event);
300 } 301 }
301 302
302 WebInputEventResult processed = prevent_default 303 WebInputEventResult processed = prevent_default
303 ? WebInputEventResult::HandledSuppressed 304 ? WebInputEventResult::HandledSuppressed
304 : WebInputEventResult::NotHandled; 305 : WebInputEventResult::NotHandled;
305 if (input_event.type() != WebInputEvent::Char || 306 if (input_event.type() != WebInputEvent::Char ||
306 !suppress_next_char_events_) { 307 !suppress_next_char_events_) {
307 suppress_next_char_events_ = false; 308 suppress_next_char_events_ = false;
308 if (processed == WebInputEventResult::NotHandled && widget_->GetWebWidget()) 309 if (processed == WebInputEventResult::NotHandled && widget_->GetWebWidget())
309 processed = widget_->GetWebWidget()->handleInputEvent(input_event); 310 processed = widget_->GetWebWidget()->handleInputEvent(coalesced_event);
310 } 311 }
311 312
312 // TODO(dtapuska): Use the input_event.timeStampSeconds as the start 313 // TODO(dtapuska): Use the input_event.timeStampSeconds as the start
313 // ideally this should be when the event was sent by the compositor to the 314 // ideally this should be when the event was sent by the compositor to the
314 // renderer. crbug.com/565348 315 // renderer. crbug.com/565348
315 if (input_event.type() == WebInputEvent::TouchStart || 316 if (input_event.type() == WebInputEvent::TouchStart ||
316 input_event.type() == WebInputEvent::TouchMove || 317 input_event.type() == WebInputEvent::TouchMove ||
317 input_event.type() == WebInputEvent::TouchEnd) { 318 input_event.type() == WebInputEvent::TouchEnd) {
318 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event); 319 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event);
319 320
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 // it can be bundled in the event ack. 463 // it can be bundled in the event ack.
463 if (handling_event_overscroll_) { 464 if (handling_event_overscroll_) {
464 *handling_event_overscroll_ = std::move(params); 465 *handling_event_overscroll_ = std::move(params);
465 return; 466 return;
466 } 467 }
467 468
468 delegate_->OnDidOverscroll(*params); 469 delegate_->OnDidOverscroll(*params);
469 } 470 }
470 471
471 } // namespace content 472 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698