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_SINGLE_POSITION_TOUCH_NOISE_FILTER_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_TOUCH_NOISE_SINGLE_POSITION_TOUCH_NOISE_FILTER_H_ |
6 #define UI_EVENTS_OZONE_EVDEV_TOUCH_NOISE_SINGLE_POSITION_TOUCH_NOISE_FILTER_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_TOUCH_NOISE_SINGLE_POSITION_TOUCH_NOISE_FILTER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "ui/events/ozone/evdev/touch_noise/touch_noise_filter.h" | 12 #include "ui/events/ozone/evdev/touch_noise/touch_noise_filter.h" |
13 | 13 |
14 namespace ui { | 14 namespace ui { |
15 | 15 |
16 class SinglePositionTouchNoiseFilter : public TouchNoiseFilter { | 16 class SinglePositionTouchNoiseFilter : public TouchNoiseFilter { |
17 public: | 17 public: |
18 SinglePositionTouchNoiseFilter(); | 18 SinglePositionTouchNoiseFilter(); |
19 ~SinglePositionTouchNoiseFilter() override {} | 19 ~SinglePositionTouchNoiseFilter() override {} |
20 | 20 |
21 // TouchNoiseFilter: | 21 // TouchNoiseFilter: |
22 void Filter(const std::vector<InProgressTouchEvdev>& touches, | 22 void Filter(const std::vector<InProgressTouchEvdev>& touches, |
23 base::TimeDelta time, | 23 base::TimeTicks time, |
24 std::bitset<kNumTouchEvdevSlots>* slots_with_noise) override; | 24 std::bitset<kNumTouchEvdevSlots>* slots_with_noise) override; |
25 | 25 |
26 private: | 26 private: |
27 struct TrackedTouch { | 27 struct TrackedTouch { |
28 TrackedTouch(); | 28 TrackedTouch(); |
29 ~TrackedTouch(); | 29 ~TrackedTouch(); |
30 | 30 |
31 bool valid; | 31 bool valid; |
32 size_t slot; | 32 size_t slot; |
33 int x; | 33 int x; |
34 int y; | 34 int y; |
35 base::TimeDelta begin; | 35 base::TimeTicks begin; |
36 base::TimeDelta end; | 36 base::TimeTicks end; |
37 | 37 |
38 // The age of the oldest touch at the same location as this TrackedTouch. | 38 // The age of the oldest touch at the same location as this TrackedTouch. |
39 // Logged to UMA when we stop tracking the TrackedTouch. | 39 // Logged to UMA when we stop tracking the TrackedTouch. |
40 base::TimeDelta same_location_touch_age; | 40 base::TimeDelta same_location_touch_age; |
41 }; | 41 }; |
42 | 42 |
43 void StopTrackingTouch(size_t index); | 43 void StopTrackingTouch(size_t index); |
44 void TrackTouch(const InProgressTouchEvdev& touch, | 44 void TrackTouch(const InProgressTouchEvdev& touch, |
45 base::TimeDelta time); | 45 base::TimeTicks time); |
46 | 46 |
47 // A mapping of slot to tracked touch index in |tracked_touches_|. | 47 // A mapping of slot to tracked touch index in |tracked_touches_|. |
48 size_t tracked_slots_[kNumTouchEvdevSlots]; | 48 size_t tracked_slots_[kNumTouchEvdevSlots]; |
49 | 49 |
50 // A circular buffer of tracked touches | 50 // A circular buffer of tracked touches |
51 // [|tracked_touches_start_|, |tracked_touches_end_|). | 51 // [|tracked_touches_start_|, |tracked_touches_end_|). |
52 static const int kNumTrackedTouches = 100; | 52 static const int kNumTrackedTouches = 100; |
53 TrackedTouch tracked_touches_[kNumTrackedTouches]; | 53 TrackedTouch tracked_touches_[kNumTrackedTouches]; |
54 | 54 |
55 size_t tracked_touches_start_; | 55 size_t tracked_touches_start_; |
56 size_t tracked_touches_end_; | 56 size_t tracked_touches_end_; |
57 }; | 57 }; |
58 | 58 |
59 } // namespace ui | 59 } // namespace ui |
60 | 60 |
61 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_NOISE_SINGLE_POSITION_TOUCH_NOISE_FILTER_
H_ | 61 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_NOISE_SINGLE_POSITION_TOUCH_NOISE_FILTER_
H_ |
OLD | NEW |