| OLD | NEW |
| 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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "content/browser/renderer_host/input/timeout_monitor.h" | 10 #include "content/browser/renderer_host/input/timeout_monitor.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 // This is the list of the original events that were coalesced, each requiring | 321 // This is the list of the original events that were coalesced, each requiring |
| 322 // future ack dispatch to the client. | 322 // future ack dispatch to the client. |
| 323 typedef std::vector<TouchEventWithLatencyInfo> WebTouchEventWithLatencyList; | 323 typedef std::vector<TouchEventWithLatencyInfo> WebTouchEventWithLatencyList; |
| 324 WebTouchEventWithLatencyList events_to_ack_; | 324 WebTouchEventWithLatencyList events_to_ack_; |
| 325 | 325 |
| 326 DISALLOW_COPY_AND_ASSIGN(CoalescedWebTouchEvent); | 326 DISALLOW_COPY_AND_ASSIGN(CoalescedWebTouchEvent); |
| 327 }; | 327 }; |
| 328 | 328 |
| 329 TouchEventQueue::Config::Config() | 329 TouchEventQueue::Config::Config() |
| 330 : touchmove_slop_suppression_length_dips(0), | 330 : touchmove_slop_suppression_length_dips(0), |
| 331 touchmove_slop_suppression_region_includes_boundary(true), | |
| 332 touch_scrolling_mode(TOUCH_SCROLLING_MODE_DEFAULT), | 331 touch_scrolling_mode(TOUCH_SCROLLING_MODE_DEFAULT), |
| 333 touch_ack_timeout_delay(base::TimeDelta::FromMilliseconds(200)), | 332 touch_ack_timeout_delay(base::TimeDelta::FromMilliseconds(200)), |
| 334 touch_ack_timeout_supported(false) { | 333 touch_ack_timeout_supported(false) { |
| 335 } | 334 } |
| 336 | 335 |
| 337 TouchEventQueue::TouchEventQueue(TouchEventQueueClient* client, | 336 TouchEventQueue::TouchEventQueue(TouchEventQueueClient* client, |
| 338 const Config& config) | 337 const Config& config) |
| 339 : client_(client), | 338 : client_(client), |
| 340 dispatching_touch_ack_(NULL), | 339 dispatching_touch_ack_(NULL), |
| 341 dispatching_touch_(false), | 340 dispatching_touch_(false), |
| 342 touch_filtering_state_(TOUCH_FILTERING_STATE_DEFAULT), | 341 touch_filtering_state_(TOUCH_FILTERING_STATE_DEFAULT), |
| 343 ack_timeout_enabled_(config.touch_ack_timeout_supported), | 342 ack_timeout_enabled_(config.touch_ack_timeout_supported), |
| 344 touchmove_slop_suppressor_(new TouchMoveSlopSuppressor( | 343 touchmove_slop_suppressor_(new TouchMoveSlopSuppressor( |
| 345 config.touchmove_slop_suppression_length_dips + | 344 config.touchmove_slop_suppression_length_dips + kSlopEpsilon)), |
| 346 (config.touchmove_slop_suppression_region_includes_boundary | |
| 347 ? kSlopEpsilon | |
| 348 : -kSlopEpsilon))), | |
| 349 send_touch_events_async_(false), | 345 send_touch_events_async_(false), |
| 350 needs_async_touchmove_for_outer_slop_region_(false), | 346 needs_async_touchmove_for_outer_slop_region_(false), |
| 351 last_sent_touch_timestamp_sec_(0), | 347 last_sent_touch_timestamp_sec_(0), |
| 352 touch_scrolling_mode_(config.touch_scrolling_mode) { | 348 touch_scrolling_mode_(config.touch_scrolling_mode) { |
| 353 DCHECK(client); | 349 DCHECK(client); |
| 354 if (ack_timeout_enabled_) { | 350 if (ack_timeout_enabled_) { |
| 355 timeout_handler_.reset( | 351 timeout_handler_.reset( |
| 356 new TouchTimeoutHandler(this, config.touch_ack_timeout_delay)); | 352 new TouchTimeoutHandler(this, config.touch_ack_timeout_delay)); |
| 357 } | 353 } |
| 358 } | 354 } |
| 359 | 355 |
| 360 TouchEventQueue::~TouchEventQueue() { | 356 TouchEventQueue::~TouchEventQueue() { |
| 361 if (!touch_queue_.empty()) | 357 if (!touch_queue_.empty()) |
| 362 STLDeleteElements(&touch_queue_); | 358 STLDeleteElements(&touch_queue_); |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 iter != end; | 814 iter != end; |
| 819 ++iter) { | 815 ++iter) { |
| 820 if (iter->second != ack_state) | 816 if (iter->second != ack_state) |
| 821 return false; | 817 return false; |
| 822 } | 818 } |
| 823 | 819 |
| 824 return true; | 820 return true; |
| 825 } | 821 } |
| 826 | 822 |
| 827 } // namespace content | 823 } // namespace content |
| OLD | NEW |