OLD | NEW |
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 SensorProxy_h | 5 #ifndef SensorProxy_h |
6 #define SensorProxy_h | 6 #define SensorProxy_h |
7 | 7 |
8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
9 #include "core/page/PageVisibilityObserver.h" | 9 #include "core/page/PageVisibilityObserver.h" |
10 #include "device/generic_sensor/public/cpp/sensor_reading.h" | 10 #include "device/generic_sensor/public/cpp/sensor_reading.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 WTF_MAKE_NONCOPYABLE(SensorProxy); | 31 WTF_MAKE_NONCOPYABLE(SensorProxy); |
32 | 32 |
33 public: | 33 public: |
34 class Observer : public GarbageCollectedMixin { | 34 class Observer : public GarbageCollectedMixin { |
35 public: | 35 public: |
36 // Has valid 'Sensor' binding, {add, remove}Configuration() | 36 // Has valid 'Sensor' binding, {add, remove}Configuration() |
37 // methods can be called. | 37 // methods can be called. |
38 virtual void OnSensorInitialized() {} | 38 virtual void OnSensorInitialized() {} |
39 // Observer should update its cached reading and send 'onchange' | 39 // Observer should update its cached reading and send 'onchange' |
40 // event if needed. | 40 // event if needed. |
41 // |timestamp| Reference timestamp in seconds of the moment when | 41 virtual void OnSensorReadingChanged() {} |
42 // sensor reading was updated from the buffer. | |
43 // Note: |timestamp| values are only used to calculate elapsed time | |
44 // between shared buffer readings. These values *do not* correspond | |
45 // to sensor reading timestamps which are obtained on platform side. | |
46 virtual void OnSensorReadingChanged(double timestamp) {} | |
47 // An error has occurred. | 42 // An error has occurred. |
48 virtual void OnSensorError(ExceptionCode, | 43 virtual void OnSensorError(ExceptionCode, |
49 const String& sanitized_message, | 44 const String& sanitized_message, |
50 const String& unsanitized_message) {} | 45 const String& unsanitized_message) {} |
51 }; | 46 }; |
52 | 47 |
53 ~SensorProxy(); | 48 ~SensorProxy(); |
54 | 49 |
55 void Dispose(); | 50 void Dispose(); |
56 | 51 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 using ReadingBuffer = device::SensorReadingSharedBuffer; | 138 using ReadingBuffer = device::SensorReadingSharedBuffer; |
144 static_assert( | 139 static_assert( |
145 sizeof(ReadingBuffer) == | 140 sizeof(ReadingBuffer) == |
146 device::mojom::blink::SensorInitParams::kReadBufferSizeForTests, | 141 device::mojom::blink::SensorInitParams::kReadBufferSizeForTests, |
147 "Check reading buffer size for tests"); | 142 "Check reading buffer size for tests"); |
148 }; | 143 }; |
149 | 144 |
150 } // namespace blink | 145 } // namespace blink |
151 | 146 |
152 #endif // SensorProxy_h | 147 #endif // SensorProxy_h |
OLD | NEW |