Bug 773792: Remove unused field SensorStatus::data and make SensorStatus::count as a array of int[] for fixing an instance of creating/desctroying XPCOM objects from a static constructor/deconstructor. r=jlebar

This commit is contained in:
Marco Chen 2012-09-04 17:56:20 +08:00
Родитель 36a101bd0d
Коммит cb37d2aa26
1 изменённых файлов: 4 добавлений и 10 удалений

Просмотреть файл

@ -164,14 +164,8 @@ private:
namespace hal_impl {
class SensorStatus {
public:
SensorData data;
DebugOnly<int> count;
};
static int sActivatedSensors = 0;
static SensorStatus sSensorStatus[NUM_SENSOR_TYPE];
static DebugOnly<int> sSensorRefCount[NUM_SENSOR_TYPE];
static base::Thread* sSwitchThread;
static void
@ -206,7 +200,7 @@ SwitchSensor(bool aActivate, sensor_t aSensor, pthread_t aThreadId)
{
int index = HardwareSensorToHalSensor(aSensor.type);
MOZ_ASSERT(sSensorStatus[index].count || aActivate);
MOZ_ASSERT(sSensorRefCount[index] || aActivate);
SensorDevice& device = SensorDevice::getInstance();
@ -218,9 +212,9 @@ SwitchSensor(bool aActivate, sensor_t aSensor, pthread_t aThreadId)
MessageLoop::current()->PostTask(FROM_HERE,
NewRunnableFunction(PollSensorsOnce));
}
sSensorStatus[index].count++;
sSensorRefCount[index]++;
} else {
sSensorStatus[index].count--;
sSensorRefCount[index]--;
--sActivatedSensors;
}
}