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

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

Issue 2704123006: [Sensors] Clamp given sampling frequency to the minimum supported one (Closed)
Patch Set: 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 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 void resume(); 74 void resume();
75 75
76 device::mojom::blink::SensorType type() const { return m_type; } 76 device::mojom::blink::SensorType type() const { return m_type; }
77 device::mojom::blink::ReportingMode reportingMode() const { return m_mode; } 77 device::mojom::blink::ReportingMode reportingMode() const { return m_mode; }
78 78
79 // Note: the returned value is reset after updateSensorReading() call. 79 // Note: the returned value is reset after updateSensorReading() call.
80 const device::SensorReading& reading() const { return m_reading; } 80 const device::SensorReading& reading() const { return m_reading; }
81 81
82 const device::mojom::blink::SensorConfiguration* defaultConfig() const; 82 const device::mojom::blink::SensorConfiguration* defaultConfig() const;
83 83
84 double maximumFrequency() const { return m_maximumFrequency; } 84 const std::pair<double, double>& frequencyLimits() const {
85 return m_frequencyLimits;
86 }
85 87
86 Document* document() const; 88 Document* document() const;
87 const WTF::Vector<double>& frequenciesUsed() const { 89 const WTF::Vector<double>& frequenciesUsed() const {
88 return m_frequenciesUsed; 90 return m_frequenciesUsed;
89 } 91 }
90 92
91 DECLARE_VIRTUAL_TRACE(); 93 DECLARE_VIRTUAL_TRACE();
92 94
93 private: 95 private:
94 friend class SensorProviderProxy; 96 friend class SensorProviderProxy;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 device::mojom::blink::SensorPtr m_sensor; 133 device::mojom::blink::SensorPtr m_sensor;
132 device::mojom::blink::SensorConfigurationPtr m_defaultConfig; 134 device::mojom::blink::SensorConfigurationPtr m_defaultConfig;
133 mojo::Binding<device::mojom::blink::SensorClient> m_clientBinding; 135 mojo::Binding<device::mojom::blink::SensorClient> m_clientBinding;
134 136
135 enum State { Uninitialized, Initializing, Initialized }; 137 enum State { Uninitialized, Initializing, Initialized };
136 State m_state; 138 State m_state;
137 mojo::ScopedSharedBufferHandle m_sharedBufferHandle; 139 mojo::ScopedSharedBufferHandle m_sharedBufferHandle;
138 mojo::ScopedSharedBufferMapping m_sharedBuffer; 140 mojo::ScopedSharedBufferMapping m_sharedBuffer;
139 bool m_suspended; 141 bool m_suspended;
140 device::SensorReading m_reading; 142 device::SensorReading m_reading;
141 double m_maximumFrequency; 143 std::pair<double, double> m_frequencyLimits;
142 144
143 Member<SensorReadingUpdater> m_readingUpdater; 145 Member<SensorReadingUpdater> m_readingUpdater;
144 WTF::Vector<double> m_frequenciesUsed; 146 WTF::Vector<double> m_frequenciesUsed;
145 double m_lastRafTimestamp; 147 double m_lastRafTimestamp;
146 148
147 using ReadingBuffer = device::SensorReadingSharedBuffer; 149 using ReadingBuffer = device::SensorReadingSharedBuffer;
148 static_assert( 150 static_assert(
149 sizeof(ReadingBuffer) == 151 sizeof(ReadingBuffer) ==
150 device::mojom::blink::SensorInitParams::kReadBufferSizeForTests, 152 device::mojom::blink::SensorInitParams::kReadBufferSizeForTests,
151 "Check reading buffer size for tests"); 153 "Check reading buffer size for tests");
152 }; 154 };
153 155
154 } // namespace blink 156 } // namespace blink
155 157
156 #endif // SensorProxy_h 158 #endif // SensorProxy_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/Sensor.cpp ('k') | third_party/WebKit/Source/modules/sensor/SensorProxy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698