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

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

Issue 2465363004: [Sensors] Consider maximum supported frequency (Closed)
Patch Set: Comments from Alex Created 4 years, 1 month 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 "device/generic_sensor/public/cpp/sensor_reading.h" 9 #include "device/generic_sensor/public/cpp/sensor_reading.h"
10 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h" 10 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 device::mojom::blink::SensorType type() const { return m_type; } 61 device::mojom::blink::SensorType type() const { return m_type; }
62 device::mojom::blink::ReportingMode reportingMode() const { return m_mode; } 62 device::mojom::blink::ReportingMode reportingMode() const { return m_mode; }
63 63
64 using Reading = device::SensorReading; 64 using Reading = device::SensorReading;
65 65
66 const Reading& reading() const { return m_reading; } 66 const Reading& reading() const { return m_reading; }
67 67
68 const device::mojom::blink::SensorConfiguration* defaultConfig() const; 68 const device::mojom::blink::SensorConfiguration* defaultConfig() const;
69 69
70 double maximumFrequency() const;
timvolodine 2016/11/03 17:32:56 nit: maybe inline?
Mikhail 2016/11/04 21:17:45 indeed, thanks
71
70 // Updates internal reading from shared buffer. 72 // Updates internal reading from shared buffer.
71 void updateInternalReading(); 73 void updateInternalReading();
72 74
73 DECLARE_VIRTUAL_TRACE(); 75 DECLARE_VIRTUAL_TRACE();
74 76
75 private: 77 private:
76 friend class SensorProviderProxy; 78 friend class SensorProviderProxy;
77 SensorProxy(device::mojom::blink::SensorType, SensorProviderProxy*); 79 SensorProxy(device::mojom::blink::SensorType, SensorProviderProxy*);
78 80
79 // device::mojom::blink::SensorClient overrides. 81 // device::mojom::blink::SensorClient overrides.
(...skipping 19 matching lines...) Expand all
99 device::mojom::blink::SensorPtr m_sensor; 101 device::mojom::blink::SensorPtr m_sensor;
100 device::mojom::blink::SensorConfigurationPtr m_defaultConfig; 102 device::mojom::blink::SensorConfigurationPtr m_defaultConfig;
101 mojo::Binding<device::mojom::blink::SensorClient> m_clientBinding; 103 mojo::Binding<device::mojom::blink::SensorClient> m_clientBinding;
102 104
103 enum State { Uninitialized, Initializing, Initialized }; 105 enum State { Uninitialized, Initializing, Initialized };
104 State m_state; 106 State m_state;
105 mojo::ScopedSharedBufferHandle m_sharedBufferHandle; 107 mojo::ScopedSharedBufferHandle m_sharedBufferHandle;
106 mojo::ScopedSharedBufferMapping m_sharedBuffer; 108 mojo::ScopedSharedBufferMapping m_sharedBuffer;
107 Reading m_reading; 109 Reading m_reading;
108 bool m_suspended; 110 bool m_suspended;
111 double m_maximumFrequency;
109 using ReadingBuffer = device::SensorReadingSharedBuffer; 112 using ReadingBuffer = device::SensorReadingSharedBuffer;
110 static_assert( 113 static_assert(
111 sizeof(ReadingBuffer) == 114 sizeof(ReadingBuffer) ==
112 device::mojom::blink::SensorInitParams::kReadBufferSizeForTests, 115 device::mojom::blink::SensorInitParams::kReadBufferSizeForTests,
113 "Check reading buffer size for tests"); 116 "Check reading buffer size for tests");
114 }; 117 };
115 118
116 } // namespace blink 119 } // namespace blink
117 120
118 #endif // SensorProxy_h 121 #endif // SensorProxy_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698