Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SensorProviderProxy_h | |
| 6 #define SensorProviderProxy_h | |
| 7 | |
| 8 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h" | |
| 9 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h" | |
| 10 #include "platform/Supplementable.h" | |
| 11 #include "platform/heap/Handle.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 class LocalFrame; | |
| 16 class SensorProxy; | |
| 17 | |
| 18 // This class wraps 'SensorProvider' mojo interface and it manages | |
| 19 // 'SensorProxy' instances. | |
| 20 class SensorProviderProxy final | |
| 21 : public GarbageCollectedFinalized<SensorProviderProxy> | |
| 22 , public Supplement<LocalFrame> { | |
| 23 USING_GARBAGE_COLLECTED_MIXIN(SensorProviderProxy); | |
| 24 WTF_MAKE_NONCOPYABLE(SensorProviderProxy); | |
| 25 public: | |
| 26 static SensorProviderProxy* from(LocalFrame*); | |
| 27 | |
| 28 ~SensorProviderProxy(); | |
| 29 | |
| 30 SensorProxy* getOrCreateSensor(device::mojom::blink::SensorType); | |
| 31 | |
| 32 DECLARE_VIRTUAL_TRACE(); | |
| 33 | |
| 34 private: | |
| 35 friend class SensorProxy; // To call sensorProvider(). | |
| 36 | |
| 37 explicit SensorProviderProxy(LocalFrame*); | |
| 38 static const char* supplementName(); | |
| 39 | |
| 40 device::mojom::blink::SensorProvider* sensorProvider() const { return m_sens orProvider.get(); } | |
| 41 | |
| 42 void onSensorProviderConnectionError(); | |
| 43 | |
| 44 using SensorsSet = HeapHashSet<Member<SensorProxy>>; | |
|
haraken
2016/09/07 02:21:56
I'm guessing that this should be WeakMembers thoug
Mikhail
2016/09/07 07:55:15
Indeed, thanks for pointing that out!
| |
| 45 SensorsSet m_sensors; | |
| 46 | |
| 47 device::mojom::blink::SensorProviderPtr m_sensorProvider; | |
| 48 }; | |
| 49 | |
| 50 } // namespace blink | |
| 51 | |
| 52 #endif // SensorProviderProxy_h | |
| OLD | NEW |