Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: third_party/WebKit/Source/modules/sensor/SensorProviderProxy.h

Issue 2644873002: [Sensors] Fix reading updates after page refresh (Closed)
Patch Set: Comments from haraken@. Rebased. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef SensorProviderProxy_h 5 #ifndef SensorProviderProxy_h
6 #define SensorProviderProxy_h 6 #define SensorProviderProxy_h
7 7
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h" 9 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h"
10 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h" 10 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h"
11 #include "platform/Supplementable.h" 11 #include "platform/Supplementable.h"
12 #include "platform/heap/Handle.h" 12 #include "platform/heap/Handle.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class Document;
17 class SensorProxy; 16 class SensorProxy;
18 class SensorReadingFactory; 17 class SensorReadingFactory;
19 18
20 // This class wraps 'SensorProvider' mojo interface and it manages 19 // This class wraps 'SensorProvider' mojo interface and it manages
21 // 'SensorProxy' instances. 20 // 'SensorProxy' instances.
22 class SensorProviderProxy final 21 class SensorProviderProxy final
23 : public GarbageCollectedFinalized<SensorProviderProxy>, 22 : public GarbageCollectedFinalized<SensorProviderProxy>,
24 public Supplement<LocalFrame> { 23 public Supplement<LocalFrame> {
25 USING_GARBAGE_COLLECTED_MIXIN(SensorProviderProxy); 24 USING_GARBAGE_COLLECTED_MIXIN(SensorProviderProxy);
26 WTF_MAKE_NONCOPYABLE(SensorProviderProxy); 25 WTF_MAKE_NONCOPYABLE(SensorProviderProxy);
27 26
28 public: 27 public:
29 static SensorProviderProxy* from(LocalFrame*); 28 static SensorProviderProxy* from(LocalFrame*);
30 29
31 ~SensorProviderProxy(); 30 ~SensorProviderProxy();
32 31
33 SensorProxy* createSensorProxy(device::mojom::blink::SensorType, 32 SensorProxy* createSensorProxy(device::mojom::blink::SensorType,
34 Document*, 33 Page*,
35 std::unique_ptr<SensorReadingFactory>); 34 std::unique_ptr<SensorReadingFactory>);
36 35
37 SensorProxy* getSensorProxy(device::mojom::blink::SensorType); 36 SensorProxy* getSensorProxy(device::mojom::blink::SensorType);
38 37
39 DECLARE_VIRTUAL_TRACE(); 38 DECLARE_VIRTUAL_TRACE();
40 39
41 private: 40 private:
42 friend class SensorProxy; // To call getSensorProvider(). 41 friend class SensorProxy; // To call getSensorProvider().
43 42
44 explicit SensorProviderProxy(LocalFrame&); 43 explicit SensorProviderProxy(LocalFrame&);
45 static const char* supplementName(); 44 static const char* supplementName();
46 void initializeIfNeeded(LocalFrame*); 45 void initializeIfNeeded(LocalFrame*);
47 bool isInitialized() const { return m_sensorProvider; } 46 bool isInitialized() const { return m_sensorProvider; }
48 47
49 device::mojom::blink::SensorProvider* getSensorProvider() const { 48 device::mojom::blink::SensorProvider* getSensorProvider() const {
50 return m_sensorProvider.get(); 49 return m_sensorProvider.get();
51 } 50 }
52 51
53 void onSensorProviderConnectionError(); 52 void onSensorProviderConnectionError();
54 53
55 using SensorsSet = HeapHashSet<WeakMember<SensorProxy>>; 54 using SensorsSet = HeapHashSet<WeakMember<SensorProxy>>;
56 SensorsSet m_sensorProxies; 55 SensorsSet m_sensorProxies;
57 56
58 device::mojom::blink::SensorProviderPtr m_sensorProvider; 57 device::mojom::blink::SensorProviderPtr m_sensorProvider;
59 }; 58 };
60 59
61 } // namespace blink 60 } // namespace blink
62 61
63 #endif // SensorProviderProxy_h 62 #endif // SensorProviderProxy_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/Sensor.cpp ('k') | third_party/WebKit/Source/modules/sensor/SensorProviderProxy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698