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

Side by Side Diff: third_party/WebKit/Source/modules/sensor/SensorReadingUpdater.h

Issue 2644873002: [Sensors] Fix reading updates after page refresh (Closed)
Patch Set: Comments from haraken@. Rebased. Created 3 years, 10 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SensorReadingUpdater_h 5 #ifndef SensorReadingUpdater_h
6 #define SensorReadingUpdater_h 6 #define SensorReadingUpdater_h
7 7
8 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h" 8 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h"
9 #include "platform/heap/Handle.h" 9 #include "platform/heap/Handle.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 class Document;
13 class SensorProxy; 14 class SensorProxy;
14 15
15 // This class encapsulates sensor reading update notification logic. 16 // This class encapsulates sensor reading update notification logic.
16 class SensorReadingUpdater : public GarbageCollected<SensorReadingUpdater> { 17 class SensorReadingUpdater : public GarbageCollected<SensorReadingUpdater> {
17 public: 18 public:
18 static SensorReadingUpdater* create(SensorProxy*, 19 static SensorReadingUpdater* create(SensorProxy*,
19 device::mojom::blink::ReportingMode); 20 device::mojom::blink::ReportingMode);
20 21
21 virtual void start(); 22 virtual void start();
22 23
23 DECLARE_VIRTUAL_TRACE(); 24 DECLARE_VIRTUAL_TRACE();
24 25
25 protected: 26 protected:
26 explicit SensorReadingUpdater(SensorProxy*); 27 explicit SensorReadingUpdater(SensorProxy*);
27 void enqueueAnimationFrameTask(); 28 void enqueueAnimationFrameTask();
28 virtual void onAnimationFrameInternal() = 0; 29 virtual void onAnimationFrameInternal() = 0;
29 30
30 Member<SensorProxy> m_sensorProxy; 31 Member<SensorProxy> m_sensorProxy;
32 WeakMember<Document> m_document;
31 bool m_hasPendingAnimationFrameTask; 33 bool m_hasPendingAnimationFrameTask;
32 34
33 private: 35 private:
34 void onAnimationFrame(); 36 void onAnimationFrame();
35 }; 37 };
36 38
37 } // namespace blink 39 } // namespace blink
38 40
39 #endif // SensorReadingUpdater_h 41 #endif // SensorReadingUpdater_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698