Index: third_party/WebKit/Source/modules/sensor/SensorPollingStrategy.h |
diff --git a/third_party/WebKit/Source/modules/sensor/SensorPollingStrategy.h b/third_party/WebKit/Source/modules/sensor/SensorPollingStrategy.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6be6515d6dd4e65c3d346c00c903a099020b2e13 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/sensor/SensorPollingStrategy.h |
@@ -0,0 +1,34 @@ |
+// 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 SensorPollingStrategy_h |
+#define SensorPollingStrategy_h |
+ |
+#include "device/sensors/sensor_factory.mojom-blink.h" |
+#include "platform/heap/Handle.h" |
+#include "wtf/Functional.h" |
+ |
+namespace blink { |
+ |
+class SensorPollingStrategy : public GarbageCollectedFinalized<SensorPollingStrategy> { |
+public: |
+ static SensorPollingStrategy* create(double frequencySec, std::unique_ptr<Function<void()>>, device::sensors::blink::ReportingMode); |
+ |
+ virtual void onSensorReadingChanged() {} |
+ virtual void startPolling() = 0; |
+ virtual void stopPolling() = 0; |
+ |
+ virtual ~SensorPollingStrategy() {} |
+ |
+ DEFINE_INLINE_VIRTUAL_TRACE() {} |
+ |
+protected: |
+ SensorPollingStrategy(double frequencySec, std::unique_ptr<Function<void()>>); |
+ double m_frequency; |
+ std::unique_ptr<Function<void()>> m_pollFunc; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // SensorPollingStrategy_h |