Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(823)

Unified Diff: third_party/WebKit/Source/modules/sensor/SensorUpdateNotificationStrategy.h

Issue 2590513002: Revert of [Sensors] Align sensor reading updates and 'onchange' notification with rAF. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/sensor/SensorUpdateNotificationStrategy.h
diff --git a/third_party/WebKit/Source/modules/sensor/SensorUpdateNotificationStrategy.h b/third_party/WebKit/Source/modules/sensor/SensorUpdateNotificationStrategy.h
new file mode 100644
index 0000000000000000000000000000000000000000..720e9a124e2d6b2ada6b0e99d0137c5b6dd134e3
--- /dev/null
+++ b/third_party/WebKit/Source/modules/sensor/SensorUpdateNotificationStrategy.h
@@ -0,0 +1,29 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SensorUpdateNotificationStrategy_h
+#define SensorUpdateNotificationStrategy_h
+
+#include "wtf/Functional.h"
+
+namespace blink {
+
+// This class encapsulates sensor reading update notification logic:
+// the callback is invoked after client calls 'onSensorReadingChanged()'
+// however considering the given sample frequency:
+// guaranteed not to be called more often than expected.
+class SensorUpdateNotificationStrategy {
+ public:
+ static std::unique_ptr<SensorUpdateNotificationStrategy> create(
+ double frequency,
+ std::unique_ptr<Function<void()>>);
+
+ virtual void onSensorReadingChanged() = 0;
+ virtual void cancelPendingNotifications() = 0;
+ virtual ~SensorUpdateNotificationStrategy() {}
+};
+
+} // namespace blink
+
+#endif // SensorUpdateNotificationStrategy_h

Powered by Google App Engine
This is Rietveld 408576698