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

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

Issue 2396573002: reflow comments in modules/[presentation,storage] (Closed)
Patch Set: Created 4 years, 2 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 SensorPollingStrategy_h 5 #ifndef SensorPollingStrategy_h
6 #define SensorPollingStrategy_h 6 #define SensorPollingStrategy_h
7 7
8 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h" 8 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h"
9 #include "platform/Timer.h" 9 #include "platform/Timer.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
11 #include "wtf/Functional.h" 11 #include "wtf/Functional.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 // This class provides different polling behaviour depending on 15 // This class provides different polling behaviour depending on
16 // the given 'ReportingMode': 16 // the given 'ReportingMode':
17 // - for 'CONTINUOUS' mode the polling function is invoked periodically 17 // - for 'CONTINUOUS' mode the polling function is invoked periodically
18 // with the given polling period (on timer event). 18 // with the given polling period (on timer event).
19 // - for 'ONCHANGE' mode the polling function is invoked only after client 19 // - for 'ONCHANGE' mode the polling function is invoked only after client
20 // calls 'onSensorReadingChanged()' however considering the given polling peri od: 20 // calls 'onSensorReadingChanged()' however considering the given polling
21 // guaranteed not to be called more often than expected. 21 // period: guaranteed not to be called more often than expected.
22 class SensorPollingStrategy { 22 class SensorPollingStrategy {
23 public: 23 public:
24 static std::unique_ptr<SensorPollingStrategy> create( 24 static std::unique_ptr<SensorPollingStrategy> create(
25 double pollingPeriod, 25 double pollingPeriod,
26 std::unique_ptr<Function<void()>> pollFunc, 26 std::unique_ptr<Function<void()>> pollFunc,
27 device::mojom::blink::ReportingMode); 27 device::mojom::blink::ReportingMode);
28 28
29 virtual void onSensorReadingChanged() {} 29 virtual void onSensorReadingChanged() {}
30 virtual void startPolling() = 0; 30 virtual void startPolling() = 0;
31 virtual void stopPolling() = 0; 31 virtual void stopPolling() = 0;
32 32
33 virtual ~SensorPollingStrategy(); 33 virtual ~SensorPollingStrategy();
34 34
35 protected: 35 protected:
36 SensorPollingStrategy(double pollingPeriod, 36 SensorPollingStrategy(double pollingPeriod,
37 std::unique_ptr<Function<void()>>); 37 std::unique_ptr<Function<void()>>);
38 virtual void pollForData(TimerBase*) = 0; 38 virtual void pollForData(TimerBase*) = 0;
39 39
40 double m_pollingPeriod; 40 double m_pollingPeriod;
41 std::unique_ptr<Function<void()>> m_pollFunc; 41 std::unique_ptr<Function<void()>> m_pollFunc;
42 Timer<SensorPollingStrategy> m_timer; 42 Timer<SensorPollingStrategy> m_timer;
43 }; 43 };
44 44
45 } // namespace blink 45 } // namespace blink
46 46
47 #endif // SensorPollingStrategy_h 47 #endif // SensorPollingStrategy_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698