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/SensorProxy.h" | 5 #include "modules/sensor/SensorProxy.h" |
6 | 6 |
7 #include "core/frame/LocalFrame.h" | 7 #include "core/frame/LocalFrame.h" |
8 #include "modules/sensor/SensorProviderProxy.h" | 8 #include "modules/sensor/SensorProviderProxy.h" |
9 #include "modules/sensor/SensorReading.h" | 9 #include "modules/sensor/SensorReading.h" |
10 #include "platform/mojo/MojoHelper.h" | 10 #include "platform/mojo/MojoHelper.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return; | 56 return; |
57 | 57 |
58 if (!m_provider->getSensorProvider()) { | 58 if (!m_provider->getSensorProvider()) { |
59 handleSensorError(); | 59 handleSensorError(); |
60 return; | 60 return; |
61 } | 61 } |
62 | 62 |
63 m_state = Initializing; | 63 m_state = Initializing; |
64 auto callback = convertToBaseCallback( | 64 auto callback = convertToBaseCallback( |
65 WTF::bind(&SensorProxy::onSensorCreated, wrapWeakPersistent(this))); | 65 WTF::bind(&SensorProxy::onSensorCreated, wrapWeakPersistent(this))); |
66 m_provider->getSensorProvider()->GetSensor(m_type, mojo::GetProxy(&m_sensor), | 66 m_provider->getSensorProvider()->GetSensor( |
67 callback); | 67 m_type, mojo::MakeRequest(&m_sensor), callback); |
68 } | 68 } |
69 | 69 |
70 void SensorProxy::addConfiguration( | 70 void SensorProxy::addConfiguration( |
71 SensorConfigurationPtr configuration, | 71 SensorConfigurationPtr configuration, |
72 std::unique_ptr<Function<void(bool)>> callback) { | 72 std::unique_ptr<Function<void(bool)>> callback) { |
73 DCHECK(isInitialized()); | 73 DCHECK(isInitialized()); |
74 auto wrapper = WTF::bind(&SensorProxy::onAddConfigurationCompleted, | 74 auto wrapper = WTF::bind(&SensorProxy::onAddConfigurationCompleted, |
75 wrapWeakPersistent(this), configuration->frequency, | 75 wrapWeakPersistent(this), configuration->frequency, |
76 WTF::passed(std::move(callback))); | 76 WTF::passed(std::move(callback))); |
77 m_sensor->AddConfiguration(std::move(configuration), | 77 m_sensor->AddConfiguration(std::move(configuration), |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 updateSensorReading(); | 294 updateSensorReading(); |
295 m_timer.startRepeating(repeatInterval, BLINK_FROM_HERE); | 295 m_timer.startRepeating(repeatInterval, BLINK_FROM_HERE); |
296 } | 296 } |
297 } | 297 } |
298 | 298 |
299 void SensorProxy::onTimerFired(TimerBase*) { | 299 void SensorProxy::onTimerFired(TimerBase*) { |
300 updateSensorReading(); | 300 updateSensorReading(); |
301 } | 301 } |
302 | 302 |
303 } // namespace blink | 303 } // namespace blink |
OLD | NEW |