| Index: third_party/WebKit/Source/modules/sensor/SensorProviderProxy.cpp
|
| diff --git a/third_party/WebKit/Source/modules/sensor/SensorProviderProxy.cpp b/third_party/WebKit/Source/modules/sensor/SensorProviderProxy.cpp
|
| index 5039dbab7b6c718112a0ef01d3ed814a7f104de9..243c8f567abd3b83ac192d914e82462333631f7b 100644
|
| --- a/third_party/WebKit/Source/modules/sensor/SensorProviderProxy.cpp
|
| +++ b/third_party/WebKit/Source/modules/sensor/SensorProviderProxy.cpp
|
| @@ -5,6 +5,7 @@
|
| #include "modules/sensor/SensorProviderProxy.h"
|
|
|
| #include "modules/sensor/SensorProxy.h"
|
| +#include "modules/sensor/SensorReading.h"
|
| #include "platform/mojo/MojoHelper.h"
|
| #include "public/platform/InterfaceProvider.h"
|
| #include "public/platform/Platform.h"
|
| @@ -41,7 +42,18 @@ DEFINE_TRACE(SensorProviderProxy) {
|
| Supplement<LocalFrame>::trace(visitor);
|
| }
|
|
|
| -SensorProxy* SensorProviderProxy::getOrCreateSensor(
|
| +SensorProxy* SensorProviderProxy::createSensor(
|
| + device::mojom::blink::SensorType type,
|
| + std::unique_ptr<SensorReadingFactory> readingFactory) {
|
| + DCHECK(!getSensor(type));
|
| +
|
| + SensorProxy* sensor = new SensorProxy(type, this, std::move(readingFactory));
|
| + m_sensors.add(sensor);
|
| +
|
| + return sensor;
|
| +}
|
| +
|
| +SensorProxy* SensorProviderProxy::getSensor(
|
| device::mojom::blink::SensorType type) {
|
| for (SensorProxy* sensor : m_sensors) {
|
| // TODO(Mikhail) : Hash sensors by type for efficiency.
|
| @@ -49,10 +61,7 @@ SensorProxy* SensorProviderProxy::getOrCreateSensor(
|
| return sensor;
|
| }
|
|
|
| - SensorProxy* sensor = new SensorProxy(type, this);
|
| - m_sensors.add(sensor);
|
| -
|
| - return sensor;
|
| + return nullptr;
|
| }
|
|
|
| void SensorProviderProxy::onSensorProviderConnectionError() {
|
|
|