Chromium Code Reviews| 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 "platform/mojo/MojoHelper.h" | 8 #include "platform/mojo/MojoHelper.h" |
| 9 #include "public/platform/InterfaceProvider.h" | 9 #include "public/platform/InterfaceProvider.h" |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 } | 32 } |
| 33 return result; | 33 return result; |
| 34 } | 34 } |
| 35 | 35 |
| 36 SensorProviderProxy::~SensorProviderProxy() | 36 SensorProviderProxy::~SensorProviderProxy() |
| 37 { | 37 { |
| 38 } | 38 } |
| 39 | 39 |
| 40 DEFINE_TRACE(SensorProviderProxy) | 40 DEFINE_TRACE(SensorProviderProxy) |
| 41 { | 41 { |
| 42 visitor->trace(m_frame); | |
| 42 visitor->trace(m_sensors); | 43 visitor->trace(m_sensors); |
| 43 Supplement<LocalFrame>::trace(visitor); | 44 Supplement<LocalFrame>::trace(visitor); |
| 44 } | 45 } |
| 45 | 46 |
| 46 SensorProxy* SensorProviderProxy::getOrCreateSensor(device::mojom::blink::Sensor Type type) | 47 SensorProxy* SensorProviderProxy::getOrCreateSensor(device::mojom::blink::Sensor Type type) |
| 47 { | 48 { |
| 48 for (SensorProxy* sensor : m_sensors) { | 49 for (SensorProxy* sensor : m_sensors) { |
| 49 // TODO(Mikhail) : Hash sensors by type for efficiency. | 50 // TODO(Mikhail) : Hash sensors by type for efficiency. |
| 50 if (sensor->type() == type) | 51 if (sensor->type() == type) |
| 51 return sensor; | 52 return sensor; |
| 52 } | 53 } |
| 53 | 54 |
| 54 SensorProxy* sensor = new SensorProxy(type, this); | 55 SensorProxy* sensor = new SensorProxy(type, m_frame->page(), this); |
|
haraken
2016/09/08 11:07:13
How is this working? It looks like that no one is
Mikhail
2016/09/08 11:24:48
Ah I missed m_frame initialization when split the
| |
| 55 m_sensors.add(sensor); | 56 m_sensors.add(sensor); |
| 56 | 57 |
| 57 return sensor; | 58 return sensor; |
| 58 } | 59 } |
| 59 | 60 |
| 60 void SensorProviderProxy::onSensorProviderConnectionError() | 61 void SensorProviderProxy::onSensorProviderConnectionError() |
| 61 { | 62 { |
| 62 m_sensorProvider.reset(); | 63 m_sensorProvider.reset(); |
| 63 for (SensorProxy* sensor : m_sensors) | 64 for (SensorProxy* sensor : m_sensors) |
| 64 sensor->handleSensorError(); | 65 sensor->handleSensorError(); |
| 65 } | 66 } |
| 66 | 67 |
| 67 } // namespace blink | 68 } // namespace blink |
| OLD | NEW |