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

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

Issue 2668173003: [Sensors] Remove SensorReading interfaces (Closed)
Patch Set: updated global-interface-listing.html 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SensorReading_h
6 #define SensorReading_h
7
8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/dom/DOMHighResTimeStamp.h"
10 #include "core/dom/DOMTimeStamp.h"
11 #include "modules/sensor/SensorProxy.h"
12
13 namespace blink {
14
15 class ScriptState;
16
17 class SensorReading : public GarbageCollectedFinalized<SensorReading>,
18 public ScriptWrappable {
19 DEFINE_WRAPPERTYPEINFO();
20
21 public:
22 DEFINE_INLINE_VIRTUAL_TRACE() {}
23
24 DOMHighResTimeStamp timeStamp(ScriptState*) const;
25
26 // Returns 'true' if the current reading value is different than the given
27 // previous one; otherwise returns 'false'.
28 virtual bool isReadingUpdated(
29 const device::SensorReading& previous) const = 0;
30
31 const device::SensorReading& data() const { return m_data; }
32
33 virtual ~SensorReading();
34
35 protected:
36 explicit SensorReading(const device::SensorReading&);
37
38 private:
39 device::SensorReading m_data;
40 };
41
42 class SensorReadingFactory {
43 public:
44 virtual SensorReading* createSensorReading(const device::SensorReading&) = 0;
45
46 protected:
47 SensorReadingFactory() = default;
48 };
49
50 template <typename SensorReadingType>
51 class SensorReadingFactoryImpl : public SensorReadingFactory {
52 public:
53 SensorReading* createSensorReading(
54 const device::SensorReading& reading) override {
55 return SensorReadingType::create(reading);
56 }
57 };
58
59 } // namepsace blink
60
61 #endif // SensorReading_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/SensorProxy.cpp ('k') | third_party/WebKit/Source/modules/sensor/SensorReading.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698