OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/events/ozone/evdev/touch_noise/touch_noise_finder.h" | |
6 | |
7 #include "base/stl_util.h" | |
8 #include "ui/events/ozone/evdev/touch_noise/far_apart_taps_touch_noise_filter.h" | |
9 #include "ui/events/ozone/evdev/touch_noise/horizontally_aligned_touch_noise_fil ter.h" | |
10 #include "ui/events/ozone/evdev/touch_noise/single_position_touch_noise_filter.h " | |
11 #include "ui/events/ozone/evdev/touch_noise/touch_noise_filter.h" | |
12 | |
13 namespace ui { | |
14 | |
15 TouchNoiseFinder::TouchNoiseFinder() { | |
16 filters_.push_back(new FarApartTapsTouchNoiseFilter); | |
17 filters_.push_back(new HorizontallyAlignedTouchNoiseFilter); | |
18 filters_.push_back(new SinglePositionTouchNoiseFilter); | |
19 } | |
20 | |
21 TouchNoiseFinder::~TouchNoiseFinder() { | |
22 STLDeleteElements(&filters_); | |
23 } | |
24 | |
25 void TouchNoiseFinder::HandleTouches( | |
26 const std::vector<InProgressTouchEvdev>& touches, | |
27 base::TimeDelta time) { | |
28 for (const InProgressTouchEvdev& touch : touches) { | |
29 if (slots_with_noise_.test(touch.slot) && touch.type == ET_TOUCH_PRESSED) | |
flackr
2015/03/13 15:08:36
Testing that it's true before setting it false is
pkotwicz
2015/03/17 01:41:26
Yes. I was doing this because reads are typically
| |
30 slots_with_noise_.set(touch.slot, false); | |
31 } | |
32 | |
33 for (TouchNoiseFilter* filter : filters_) | |
34 filter->Filter(touches, time, &slots_with_noise_); | |
35 } | |
36 | |
37 bool TouchNoiseFinder::SlotHasNoise(size_t slot) const { | |
38 return slots_with_noise_.test(slot); | |
39 } | |
40 | |
41 } // namespace ui | |
OLD | NEW |