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

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

Issue 2367253006: Check for touch event queue size before popping. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 void TouchEventQueue::PopTouchEventToClient( 759 void TouchEventQueue::PopTouchEventToClient(
760 InputEventAckState ack_result, 760 InputEventAckState ack_result,
761 const LatencyInfo& renderer_latency_info) { 761 const LatencyInfo& renderer_latency_info) {
762 AckTouchEventToClient(ack_result, &renderer_latency_info); 762 AckTouchEventToClient(ack_result, &renderer_latency_info);
763 } 763 }
764 764
765 void TouchEventQueue::AckTouchEventToClient( 765 void TouchEventQueue::AckTouchEventToClient(
766 InputEventAckState ack_result, 766 InputEventAckState ack_result,
767 const ui::LatencyInfo* optional_latency_info) { 767 const ui::LatencyInfo* optional_latency_info) {
768 DCHECK(!dispatching_touch_ack_); 768 DCHECK(!dispatching_touch_ack_);
769 DCHECK(!touch_queue_.empty()); 769 if (touch_queue_.empty()) {
770 NOTREACHED() << "Incorrect number of acks";
mustaq 2016/09/27 19:53:25 Nit: "Too many acks"?
771 return;
772 }
770 std::unique_ptr<CoalescedWebTouchEvent> acked_event(touch_queue_.front()); 773 std::unique_ptr<CoalescedWebTouchEvent> acked_event(touch_queue_.front());
771 DCHECK(acked_event); 774 DCHECK(acked_event);
772 775
773 UpdateTouchConsumerStates(acked_event->coalesced_event().event, ack_result); 776 UpdateTouchConsumerStates(acked_event->coalesced_event().event, ack_result);
774 777
775 // Note that acking the touch-event may result in multiple gestures being sent 778 // Note that acking the touch-event may result in multiple gestures being sent
776 // to the renderer, or touch-events being queued. 779 // to the renderer, or touch-events being queued.
777 base::AutoReset<bool> dispatching_touch_ack(&dispatching_touch_ack_, true); 780 base::AutoReset<bool> dispatching_touch_ack(&dispatching_touch_ack_, true);
778 781
779 // Skip ack for TouchScrollStarted since it was synthesized within the queue. 782 // Skip ack for TouchScrollStarted since it was synthesized within the queue.
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) 934 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED)
932 send_touch_events_async_ = false; 935 send_touch_events_async_ = false;
933 has_handler_for_current_sequence_ |= 936 has_handler_for_current_sequence_ |=
934 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; 937 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
935 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) { 938 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) {
936 has_handler_for_current_sequence_ = false; 939 has_handler_for_current_sequence_ = false;
937 } 940 }
938 } 941 }
939 942
940 } // namespace content 943 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698