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 #include "modules/sensor/Sensor.h" | 5 #include "modules/sensor/Sensor.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
9 #include "core/dom/ExecutionContextTask.h" | 9 #include "core/dom/ExecutionContextTask.h" |
10 #include "core/inspector/ConsoleMessage.h" | 10 #include "core/inspector/ConsoleMessage.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 } | 228 } |
229 | 229 |
230 m_sensorProxy->addObserver(this); | 230 m_sensorProxy->addObserver(this); |
231 if (!m_sensorProxy->isInitialized()) { | 231 if (!m_sensorProxy->isInitialized()) { |
232 m_sensorProxy->initialize(); | 232 m_sensorProxy->initialize(); |
233 return; | 233 return; |
234 } | 234 } |
235 | 235 |
236 if (!m_configuration) { | 236 if (!m_configuration) { |
237 m_configuration = | 237 m_configuration = |
238 createSensorConfig(m_sensorOptions, *m_sensorProxy->defaultConfig()); | 238 createSensorConfig(m_sensorOptions, *m_sensorProxy->defaultConfig(), |
| 239 m_sensorProxy->maxSupportedFrequency()); |
239 DCHECK(m_configuration); | 240 DCHECK(m_configuration); |
240 } | 241 } |
241 | 242 |
242 auto startCallback = | 243 auto startCallback = |
243 WTF::bind(&Sensor::onStartRequestCompleted, wrapWeakPersistent(this)); | 244 WTF::bind(&Sensor::onStartRequestCompleted, wrapWeakPersistent(this)); |
244 m_sensorProxy->addConfiguration(m_configuration->Clone(), | 245 m_sensorProxy->addConfiguration(m_configuration->Clone(), |
245 std::move(startCallback)); | 246 std::move(startCallback)); |
246 } | 247 } |
247 | 248 |
248 void Sensor::stopListening() { | 249 void Sensor::stopListening() { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 void Sensor::notifyStateChanged() { | 332 void Sensor::notifyStateChanged() { |
332 dispatchEvent(Event::create(EventTypeNames::statechange)); | 333 dispatchEvent(Event::create(EventTypeNames::statechange)); |
333 } | 334 } |
334 | 335 |
335 void Sensor::notifyError(DOMException* error) { | 336 void Sensor::notifyError(DOMException* error) { |
336 dispatchEvent( | 337 dispatchEvent( |
337 SensorErrorEvent::create(EventTypeNames::error, std::move(error))); | 338 SensorErrorEvent::create(EventTypeNames::error, std::move(error))); |
338 } | 339 } |
339 | 340 |
340 } // namespace blink | 341 } // namespace blink |
OLD | NEW |