OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 #ifndef SensorUpdateNotificationStrategy_h | |
6 #define SensorUpdateNotificationStrategy_h | |
7 | |
8 #include "wtf/Functional.h" | |
9 | |
10 namespace blink { | |
11 | |
12 // This class encapsulates sensor reading update notification logic: | |
13 // the callback is invoked after client calls 'onSensorReadingChanged()' | |
14 // however considering the given sample frequency: | |
15 // guaranteed not to be called more often than expected. | |
16 class SensorUpdateNotificationStrategy { | |
17 public: | |
18 static std::unique_ptr<SensorUpdateNotificationStrategy> create( | |
19 double frequency, | |
20 std::unique_ptr<Function<void()>>); | |
21 | |
22 virtual void onSensorReadingChanged() = 0; | |
23 virtual void cancelPendingNotifications() = 0; | |
24 virtual ~SensorUpdateNotificationStrategy() {} | |
25 }; | |
26 | |
27 } // namespace blink | |
28 | |
29 #endif // SensorUpdateNotificationStrategy_h | |
OLD | NEW |