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

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

Issue 2551223003: [Sensors] Align sensor reading updates and 'onchange' notification with rAF. (Closed)
Patch Set: rebased 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/SensorReadingUpdater.h
diff --git a/third_party/WebKit/Source/modules/sensor/SensorReadingUpdater.h b/third_party/WebKit/Source/modules/sensor/SensorReadingUpdater.h
new file mode 100644
index 0000000000000000000000000000000000000000..fa28150c3dc05290174237c19c506e00704b4f07
--- /dev/null
+++ b/third_party/WebKit/Source/modules/sensor/SensorReadingUpdater.h
@@ -0,0 +1,39 @@
+// 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 SensorReadingUpdater_h
+#define SensorReadingUpdater_h
+
+#include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h"
+#include "platform/heap/Handle.h"
+
+namespace blink {
+
+class SensorProxy;
+
+// This class encapsulates sensor reading update notification logic.
+class SensorReadingUpdater : public GarbageCollected<SensorProxy> {
+ public:
+ static SensorReadingUpdater* create(SensorProxy*,
+ device::mojom::blink::ReportingMode);
+
+ virtual void start();
+
+ DECLARE_VIRTUAL_TRACE();
+
+ protected:
+ explicit SensorReadingUpdater(SensorProxy*);
+ void enqueueAnimationFrameTask();
+ virtual void onAnimationFrameInternal() = 0;
+
+ Member<SensorProxy> m_sensorProxy;
+ bool m_hasPendingAnimationFrameTask;
+
+ private:
+ void onAnimationFrame();
+};
+
+} // namespace blink
+
+#endif // SensorReadingUpdater_h

Powered by Google App Engine
This is Rietveld 408576698