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

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: Rebase 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 context_menu_source_type_(ui::MENU_SOURCE_MOUSE), 200 context_menu_source_type_(ui::MENU_SOURCE_MOUSE),
201 suppress_next_char_events_(false) { 201 suppress_next_char_events_(false) {
202 DCHECK(delegate); 202 DCHECK(delegate);
203 DCHECK(widget); 203 DCHECK(widget);
204 delegate->SetInputHandler(this); 204 delegate->SetInputHandler(this);
205 } 205 }
206 206
207 RenderWidgetInputHandler::~RenderWidgetInputHandler() {} 207 RenderWidgetInputHandler::~RenderWidgetInputHandler() {}
208 208
209 void RenderWidgetInputHandler::HandleInputEvent( 209 void RenderWidgetInputHandler::HandleInputEvent(
210 const WebInputEvent& input_event, 210 const blink::WebCoalescedInputEvent& coalesced_event,
211 const ui::LatencyInfo& latency_info, 211 const ui::LatencyInfo& latency_info,
212 InputEventDispatchType dispatch_type) { 212 InputEventDispatchType dispatch_type) {
213 const WebInputEvent& input_event = coalesced_event.event();
213 base::AutoReset<bool> handling_input_event_resetter(&handling_input_event_, 214 base::AutoReset<bool> handling_input_event_resetter(&handling_input_event_,
214 true); 215 true);
215 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( 216 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter(
216 &handling_event_type_, input_event.type()); 217 &handling_event_type_, input_event.type());
217 218
218 // Calls into |didOverscroll()| while handling this event will populate 219 // Calls into |didOverscroll()| while handling this event will populate
219 // |event_overscroll|, which in turn will be bundled with the event ack. 220 // |event_overscroll|, which in turn will be bundled with the event ack.
220 std::unique_ptr<DidOverscrollParams> event_overscroll; 221 std::unique_ptr<DidOverscrollParams> event_overscroll;
221 base::AutoReset<std::unique_ptr<DidOverscrollParams>*> 222 base::AutoReset<std::unique_ptr<DidOverscrollParams>*>
222 handling_event_overscroll_resetter(&handling_event_overscroll_, 223 handling_event_overscroll_resetter(&handling_event_overscroll_,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 prevent_default || delegate_->WillHandleGestureEvent(gesture_event); 302 prevent_default || delegate_->WillHandleGestureEvent(gesture_event);
302 } 303 }
303 304
304 WebInputEventResult processed = prevent_default 305 WebInputEventResult processed = prevent_default
305 ? WebInputEventResult::HandledSuppressed 306 ? WebInputEventResult::HandledSuppressed
306 : WebInputEventResult::NotHandled; 307 : WebInputEventResult::NotHandled;
307 if (input_event.type() != WebInputEvent::Char || 308 if (input_event.type() != WebInputEvent::Char ||
308 !suppress_next_char_events_) { 309 !suppress_next_char_events_) {
309 suppress_next_char_events_ = false; 310 suppress_next_char_events_ = false;
310 if (processed == WebInputEventResult::NotHandled && widget_->GetWebWidget()) 311 if (processed == WebInputEventResult::NotHandled && widget_->GetWebWidget())
311 processed = widget_->GetWebWidget()->handleInputEvent(input_event); 312 processed = widget_->GetWebWidget()->handleInputEvent(coalesced_event);
312 } 313 }
313 314
314 // TODO(dtapuska): Use the input_event.timeStampSeconds as the start 315 // TODO(dtapuska): Use the input_event.timeStampSeconds as the start
315 // ideally this should be when the event was sent by the compositor to the 316 // ideally this should be when the event was sent by the compositor to the
316 // renderer. crbug.com/565348 317 // renderer. crbug.com/565348
317 if (input_event.type() == WebInputEvent::TouchStart || 318 if (input_event.type() == WebInputEvent::TouchStart ||
318 input_event.type() == WebInputEvent::TouchMove || 319 input_event.type() == WebInputEvent::TouchMove ||
319 input_event.type() == WebInputEvent::TouchEnd) { 320 input_event.type() == WebInputEvent::TouchEnd) {
320 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event); 321 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event);
321 322
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 // it can be bundled in the event ack. 464 // it can be bundled in the event ack.
464 if (handling_event_overscroll_) { 465 if (handling_event_overscroll_) {
465 *handling_event_overscroll_ = std::move(params); 466 *handling_event_overscroll_ = std::move(params);
466 return; 467 return;
467 } 468 }
468 469
469 delegate_->OnDidOverscroll(*params); 470 delegate_->OnDidOverscroll(*params);
470 } 471 }
471 472
472 } // namespace content 473 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/input/render_widget_input_handler.h ('k') | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698