OLD | NEW |
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 #ifndef UI_EVENTS_OZONE_EVDEV_TOUCH_NOISE_TOUCH_NOISE_FINDER_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_TOUCH_NOISE_TOUCH_NOISE_FINDER_H_ |
6 #define UI_EVENTS_OZONE_EVDEV_TOUCH_NOISE_TOUCH_NOISE_FINDER_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_TOUCH_NOISE_TOUCH_NOISE_FINDER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <bitset> | 10 #include <bitset> |
(...skipping 10 matching lines...) Expand all Loading... |
21 // Finds touches which are likely touch noise. | 21 // Finds touches which are likely touch noise. |
22 class EVENTS_OZONE_EVDEV_EXPORT TouchNoiseFinder { | 22 class EVENTS_OZONE_EVDEV_EXPORT TouchNoiseFinder { |
23 public: | 23 public: |
24 TouchNoiseFinder(); | 24 TouchNoiseFinder(); |
25 ~TouchNoiseFinder(); | 25 ~TouchNoiseFinder(); |
26 | 26 |
27 // Updates which ABS_MT_SLOTs are noise. |touches| should contain all of the | 27 // Updates which ABS_MT_SLOTs are noise. |touches| should contain all of the |
28 // in-progress touches at |time| (including noisy touches). | 28 // in-progress touches at |time| (including noisy touches). |
29 // |touches| should have at most one entry per ABS_MT_SLOT. | 29 // |touches| should have at most one entry per ABS_MT_SLOT. |
30 void HandleTouches(const std::vector<InProgressTouchEvdev>& touches, | 30 void HandleTouches(const std::vector<InProgressTouchEvdev>& touches, |
31 base::TimeDelta time); | 31 base::TimeTicks time); |
32 | 32 |
33 // Returns whether the in-progress touch at ABS_MT_SLOT |slot| is noise. | 33 // Returns whether the in-progress touch at ABS_MT_SLOT |slot| is noise. |
34 bool SlotHasNoise(size_t slot) const; | 34 bool SlotHasNoise(size_t slot) const; |
35 | 35 |
36 private: | 36 private: |
37 // Records how frequently noisy touches occur to UMA. | 37 // Records how frequently noisy touches occur to UMA. |
38 void RecordUMA(bool had_noise, base::TimeDelta time); | 38 void RecordUMA(bool had_noise, base::TimeTicks time); |
39 | 39 |
40 friend class TouchEventConverterEvdevTouchNoiseTest; | 40 friend class TouchEventConverterEvdevTouchNoiseTest; |
41 | 41 |
42 // The slots which are noise. | 42 // The slots which are noise. |
43 std::bitset<kNumTouchEvdevSlots> slots_with_noise_; | 43 std::bitset<kNumTouchEvdevSlots> slots_with_noise_; |
44 | 44 |
45 // The time of the previous noise occurence in any of the slots. | 45 // The time of the previous noise occurence in any of the slots. |
46 base::TimeDelta last_noise_time_; | 46 base::TimeTicks last_noise_time_; |
47 | 47 |
48 std::vector<TouchNoiseFilter*> filters_; | 48 std::vector<TouchNoiseFilter*> filters_; |
49 | 49 |
50 DISALLOW_COPY_AND_ASSIGN(TouchNoiseFinder); | 50 DISALLOW_COPY_AND_ASSIGN(TouchNoiseFinder); |
51 }; | 51 }; |
52 | 52 |
53 } // namespace ui | 53 } // namespace ui |
54 | 54 |
55 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_NOISE_TOUCH_NOISE_FINDER_H_ | 55 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_NOISE_TOUCH_NOISE_FINDER_H_ |
OLD | NEW |