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

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

Issue 2569273002: Add constructors to WebInputEvents and setters so we can work at cleaning up these public structs. (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 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/browser/renderer_host/input/touch_event_queue.h" 5 #include "content/browser/renderer_host/input/touch_event_queue.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
14 #include "content/browser/renderer_host/input/timeout_monitor.h" 14 #include "content/browser/renderer_host/input/timeout_monitor.h"
15 #include "content/common/input/web_touch_event_traits.h" 15 #include "content/common/input/web_touch_event_traits.h"
16 #include "ui/events/base_event_utils.h"
16 #include "ui/gfx/geometry/point_f.h" 17 #include "ui/gfx/geometry/point_f.h"
17 18
18 using blink::WebInputEvent; 19 using blink::WebInputEvent;
19 using blink::WebTouchEvent; 20 using blink::WebTouchEvent;
20 using blink::WebTouchPoint; 21 using blink::WebTouchPoint;
21 using ui::LatencyInfo; 22 using ui::LatencyInfo;
22 23
23 namespace content { 24 namespace content {
24 namespace { 25 namespace {
25 26
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // triggered by TouchEventQueue::AckTouchEventToClient, which has just 498 // triggered by TouchEventQueue::AckTouchEventToClient, which has just
498 // received an ack for the in-flight event. We leave the head of the queue 499 // received an ack for the in-flight event. We leave the head of the queue
499 // untouched since it is the in-flight event. 500 // untouched since it is the in-flight event.
500 // 501 //
501 // However, for the (integration) tests in RenderWidgetHostTest that trigger 502 // However, for the (integration) tests in RenderWidgetHostTest that trigger
502 // this method indirectly, they push the TouchScrollStarted event into 503 // this method indirectly, they push the TouchScrollStarted event into
503 // TouchEventQueue without any way to dispatch it. Below we added a check for 504 // TouchEventQueue without any way to dispatch it. Below we added a check for
504 // non-empty queue to keep those tests as-is w/o exposing internals of this 505 // non-empty queue to keep those tests as-is w/o exposing internals of this
505 // class all the way up. 506 // class all the way up.
506 if (!touch_queue_.empty()) { 507 if (!touch_queue_.empty()) {
507 TouchEventWithLatencyInfo touch; 508 TouchEventWithLatencyInfo touch(
508 touch.event.type = WebInputEvent::TouchScrollStarted; 509 WebInputEvent::TouchScrollStarted, WebInputEvent::NoModifiers,
509 touch.event.uniqueTouchEventId = 0; 510 ui::EventTimeStampToSeconds(ui::EventTimeForNow()), LatencyInfo());
510 touch.event.touchesLength = 0;
511 touch.event.dispatchType = WebInputEvent::EventNonBlocking; 511 touch.event.dispatchType = WebInputEvent::EventNonBlocking;
512 512
513 auto it = touch_queue_.begin(); 513 auto it = touch_queue_.begin();
514 DCHECK(it != touch_queue_.end()); 514 DCHECK(it != touch_queue_.end());
515 touch_queue_.insert(++it, 515 touch_queue_.insert(++it,
516 base::MakeUnique<CoalescedWebTouchEvent>(touch, false)); 516 base::MakeUnique<CoalescedWebTouchEvent>(touch, false));
517 } 517 }
518 } 518 }
519 519
520 void TouchEventQueue::ProcessTouchAck(InputEventAckState ack_result, 520 void TouchEventQueue::ProcessTouchAck(InputEventAckState ack_result,
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) 936 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED)
937 send_touch_events_async_ = false; 937 send_touch_events_async_ = false;
938 has_handler_for_current_sequence_ |= 938 has_handler_for_current_sequence_ |=
939 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; 939 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
940 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) { 940 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) {
941 has_handler_for_current_sequence_ = false; 941 has_handler_for_current_sequence_ = false;
942 } 942 }
943 } 943 }
944 944
945 } // namespace content 945 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698