1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
commit ff627ab4afeb
Author: Gabriele Svelto <gsvelto@mozilla.com>
Date: Tue Jun 19 09:18:09 2018 +0200
Bug 1469309 - Remove an unused sensor type; r=agaynor a=lizzard
--HG--
extra : source : 12d7dd36b8ccb80e866d0da7fcb7e44fcb690b0b
extra : intermediate-source : 3dd88f4a8884fe4327fc08588dce1fe221c45bcb
---
hal/Hal.cpp | 1 +
hal/HalSensor.h | 3 +--
hal/sandbox/SandboxHal.cpp | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git hal/Hal.cpp hal/Hal.cpp
index e03b7fdfab2f6..7845d5072ee53 100644
--- hal/Hal.cpp
+++ hal/Hal.cpp
@@ -426,6 +426,7 @@ UnregisterSensorObserver(SensorType aSensor, ISensorObserver *aObserver) {
AssertMainThread();
if (!gSensorObservers) {
+ HAL_ERR("Un-registering a sensor when none have been registered");
return;
}
diff --git hal/HalSensor.h hal/HalSensor.h
index 551c4271d5395..5175629c9ab33 100644
--- hal/HalSensor.h
+++ hal/HalSensor.h
@@ -18,7 +18,6 @@ namespace hal {
* If you add or change any here, do the same in GeckoHalDefines.java.
*/
enum SensorType {
- SENSOR_UNKNOWN = -1,
SENSOR_ORIENTATION = 0,
SENSOR_ACCELERATION = 1,
SENSOR_PROXIMITY = 2,
@@ -63,7 +62,7 @@ namespace IPC {
struct ParamTraits<mozilla::hal::SensorType>:
public ContiguousEnumSerializer<
mozilla::hal::SensorType,
- mozilla::hal::SENSOR_UNKNOWN,
+ mozilla::hal::SENSOR_ORIENTATION,
mozilla::hal::NUM_SENSOR_TYPE> {
};
diff --git hal/sandbox/SandboxHal.cpp hal/sandbox/SandboxHal.cpp
index 73b106da73d0a..cf0ccb483ed57 100644
--- hal/sandbox/SandboxHal.cpp
+++ hal/sandbox/SandboxHal.cpp
@@ -16,6 +16,7 @@
#include "mozilla/dom/network/Types.h"
#include "mozilla/dom/ScreenOrientation.h"
#include "mozilla/fallback/FallbackScreenConfiguration.h"
+#include "mozilla/EnumeratedRange.h"
#include "mozilla/Observer.h"
#include "mozilla/Unused.h"
#include "nsAutoPtr.h"
@@ -232,9 +233,8 @@ public:
hal::UnregisterBatteryObserver(this);
hal::UnregisterNetworkObserver(this);
hal::UnregisterScreenConfigurationObserver(this);
- for (int32_t sensor = SENSOR_UNKNOWN + 1;
- sensor < NUM_SENSOR_TYPE; ++sensor) {
- hal::UnregisterSensorObserver(SensorType(sensor), this);
+ for (auto sensor : MakeEnumeratedRange(NUM_SENSOR_TYPE)) {
+ hal::UnregisterSensorObserver(sensor, this);
}
hal::UnregisterWakeLockObserver(this);
}
|