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

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

Issue 2051083002: WIP : Generic Sensor API implementation Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 4 years, 6 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 SensorReading_h 5 #ifndef SensorReading_h
6 #define SensorReading_h 6 #define SensorReading_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/dom/DOMHighResTimeStamp.h" 9 #include "core/dom/DOMHighResTimeStamp.h"
10 #include "core/dom/DOMTimeStamp.h" 10 #include "core/dom/DOMTimeStamp.h"
11 #include "modules/ModulesExport.h" 11 #include "modules/ModulesExport.h"
12 #include "modules/sensor/SensorController.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class MODULES_EXPORT SensorReading : public GarbageCollectedFinalized<SensorRead ing>, public ScriptWrappable { 16 class MODULES_EXPORT SensorReading : public GarbageCollected<SensorReading>,
17 public ScriptWrappable {
16 DEFINE_WRAPPERTYPEINFO(); 18 DEFINE_WRAPPERTYPEINFO();
17
18 public: 19 public:
19 static SensorReading* create()
20 {
21 return new SensorReading;
22 }
23
24 static SensorReading* create(bool providesTimeStamp, DOMHighResTimeStamp tim estamp)
25 {
26 return new SensorReading(providesTimeStamp, timestamp);
27 }
28
29 virtual ~SensorReading();
30
31 DOMHighResTimeStamp timeStamp(bool& isNull);
32
33 void setTimeStamp(DOMHighResTimeStamp time) { m_timeStamp = time; }
34
35 DECLARE_VIRTUAL_TRACE(); 20 DECLARE_VIRTUAL_TRACE();
36 21
22 virtual DOMHighResTimeStamp timeStamp() const = 0;
23
24 enum UpdateStatus {
25 Updated,
26 Error,
27 Same
28 };
29 virtual UpdateStatus updateInternalData() = 0;
30
37 protected: 31 protected:
38 bool m_canProvideTimeStamp; 32 SensorReading() = default;
39 DOMHighResTimeStamp m_timeStamp; 33 explicit SensorReading(SensorController* controller);
40 34
41 SensorReading(); 35 protected:
42 SensorReading(bool providesTimeStamp, DOMHighResTimeStamp timestamp); 36 WeakMember<SensorController> m_controller;
43 }; 37 };
44 38
45 } // namepsace blink 39 } // namepsace blink
46 40
47 #endif // SensorReading_h 41 #endif // SensorReading_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698