| 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/SensorProviderProxy.h" | 5 #include "modules/sensor/SensorProviderProxy.h" |
| 6 | 6 |
| 7 #include "modules/sensor/SensorProxy.h" | 7 #include "modules/sensor/SensorProxy.h" |
| 8 #include "modules/sensor/SensorReading.h" | 8 #include "modules/sensor/SensorReading.h" |
| 9 #include "platform/mojo/MojoHelper.h" | 9 #include "platform/mojo/MojoHelper.h" |
| 10 #include "public/platform/InterfaceProvider.h" | 10 #include "public/platform/InterfaceProvider.h" |
| 11 #include "public/platform/Platform.h" | 11 #include "public/platform/Platform.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 // SensorProviderProxy | 15 // SensorProviderProxy |
| 16 SensorProviderProxy::SensorProviderProxy(LocalFrame* frame) { | 16 SensorProviderProxy::SensorProviderProxy(LocalFrame* frame) { |
| 17 initialize(frame); | 17 initialize(frame); |
| 18 } | 18 } |
| 19 | 19 |
| 20 void SensorProviderProxy::initialize(LocalFrame* frame) { | 20 void SensorProviderProxy::initialize(LocalFrame* frame) { |
| 21 DCHECK(!isInitialized()); | 21 DCHECK(!isInitialized()); |
| 22 | 22 |
| 23 frame->interfaceProvider()->getInterface(mojo::GetProxy(&m_sensorProvider)); | 23 frame->interfaceProvider()->getInterface( |
| 24 mojo::MakeRequest(&m_sensorProvider)); |
| 24 m_sensorProvider.set_connection_error_handler(convertToBaseCallback( | 25 m_sensorProvider.set_connection_error_handler(convertToBaseCallback( |
| 25 WTF::bind(&SensorProviderProxy::onSensorProviderConnectionError, | 26 WTF::bind(&SensorProviderProxy::onSensorProviderConnectionError, |
| 26 wrapWeakPersistent(this)))); | 27 wrapWeakPersistent(this)))); |
| 27 } | 28 } |
| 28 | 29 |
| 29 const char* SensorProviderProxy::supplementName() { | 30 const char* SensorProviderProxy::supplementName() { |
| 30 return "SensorProvider"; | 31 return "SensorProvider"; |
| 31 } | 32 } |
| 32 | 33 |
| 33 // static | 34 // static |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // TODO(rockot): Clean this up once renderer shutdown sequence is fixed. | 83 // TODO(rockot): Clean this up once renderer shutdown sequence is fixed. |
| 83 return; | 84 return; |
| 84 } | 85 } |
| 85 | 86 |
| 86 m_sensorProvider.reset(); | 87 m_sensorProvider.reset(); |
| 87 for (SensorProxy* sensor : m_sensorProxies) | 88 for (SensorProxy* sensor : m_sensorProxies) |
| 88 sensor->handleSensorError(); | 89 sensor->handleSensorError(); |
| 89 } | 90 } |
| 90 | 91 |
| 91 } // namespace blink | 92 } // namespace blink |
| OLD | NEW |