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

Side by Side Diff: ui/aura/gestures/gesture_recognizer_unittest.cc

Issue 2869823003: [VSync Queue] Plug touch ack to gesture events and flush vsync queue if necessary (Closed)
Patch Set: Fix MSAN Use-of-uninitialized-value: Initialize GestureEventDetails Created 3 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 ~QueueTouchEventDelegate() override {} 345 ~QueueTouchEventDelegate() override {}
346 346
347 void OnTouchEvent(ui::TouchEvent* event) override { 347 void OnTouchEvent(ui::TouchEvent* event) override {
348 event->DisableSynchronousHandling(); 348 event->DisableSynchronousHandling();
349 if (synchronous_ack_for_next_event_ != AckState::PENDING) { 349 if (synchronous_ack_for_next_event_ != AckState::PENDING) {
350 ui::GestureRecognizer::Get()->AckTouchEvent( 350 ui::GestureRecognizer::Get()->AckTouchEvent(
351 event->unique_event_id(), 351 event->unique_event_id(),
352 synchronous_ack_for_next_event_ == AckState::CONSUMED 352 synchronous_ack_for_next_event_ == AckState::CONSUMED
353 ? ui::ER_CONSUMED 353 ? ui::ER_CONSUMED
354 : ui::ER_UNHANDLED, 354 : ui::ER_UNHANDLED,
355 window_); 355 false /* is_source_touch_event_set_non_blocking */, window_);
356 synchronous_ack_for_next_event_ = AckState::PENDING; 356 synchronous_ack_for_next_event_ = AckState::PENDING;
357 } else { 357 } else {
358 sent_events_ids_.push_back(event->unique_event_id()); 358 sent_events_ids_.push_back(event->unique_event_id());
359 } 359 }
360 } 360 }
361 361
362 void ReceivedAck() { 362 void ReceivedAck() {
363 ReceivedAckImpl(false); 363 ReceivedAckImpl(false);
364 } 364 }
365 365
(...skipping 16 matching lines...) Expand all
382 }; 382 };
383 383
384 void ReceivedAckImpl(bool prevent_defaulted) { 384 void ReceivedAckImpl(bool prevent_defaulted) {
385 DCHECK(!sent_events_ids_.empty()); 385 DCHECK(!sent_events_ids_.empty());
386 if (sent_events_ids_.empty()) 386 if (sent_events_ids_.empty())
387 return; 387 return;
388 uint32_t sent_event_id = sent_events_ids_.front(); 388 uint32_t sent_event_id = sent_events_ids_.front();
389 sent_events_ids_.pop_front(); 389 sent_events_ids_.pop_front();
390 dispatcher_->ProcessedTouchEvent( 390 dispatcher_->ProcessedTouchEvent(
391 sent_event_id, window_, 391 sent_event_id, window_,
392 prevent_defaulted ? ui::ER_HANDLED : ui::ER_UNHANDLED); 392 prevent_defaulted ? ui::ER_HANDLED : ui::ER_UNHANDLED,
393 false /* is_source_touch_event_set_non_blocking */);
393 } 394 }
394 395
395 Window* window_; 396 Window* window_;
396 WindowEventDispatcher* dispatcher_; 397 WindowEventDispatcher* dispatcher_;
397 AckState synchronous_ack_for_next_event_; 398 AckState synchronous_ack_for_next_event_;
398 std::list<uint32_t> sent_events_ids_; 399 std::list<uint32_t> sent_events_ids_;
399 400
400 DISALLOW_COPY_AND_ASSIGN(QueueTouchEventDelegate); 401 DISALLOW_COPY_AND_ASSIGN(QueueTouchEventDelegate);
401 }; 402 };
402 403
(...skipping 4367 matching lines...) Expand 10 before | Expand all | Expand 10 after
4770 4771
4771 window->Hide(); 4772 window->Hide();
4772 4773
4773 delegate->Reset(); 4774 delegate->Reset();
4774 delegate->ReceivedAck(); 4775 delegate->ReceivedAck();
4775 EXPECT_0_EVENTS(delegate->events()); 4776 EXPECT_0_EVENTS(delegate->events());
4776 } 4777 }
4777 4778
4778 } // namespace test 4779 } // namespace test
4779 } // namespace aura 4780 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698