hal/HalSensor.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* vim: set sw=2 ts=8 et ft=cpp : */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef __HAL_SENSOR_H_
     8 #define __HAL_SENSOR_H_
    10 #include "mozilla/Observer.h"
    12 namespace mozilla {
    13 namespace hal {
    15 /**
    16  * Enumeration of sensor types.  They are used to specify type while
    17  * register or unregister an observer for a sensor of given type.
    18  */
    19 enum SensorType {
    20   SENSOR_UNKNOWN = -1,
    21   SENSOR_ORIENTATION,
    22   SENSOR_ACCELERATION,
    23   SENSOR_PROXIMITY,
    24   SENSOR_LINEAR_ACCELERATION,
    25   SENSOR_GYROSCOPE,
    26   SENSOR_LIGHT,
    27   NUM_SENSOR_TYPE
    28 };
    30 class SensorData;
    32 typedef Observer<SensorData> ISensorObserver;
    34 /**
    35  * Enumeration of sensor accuracy types.
    36  */
    37 enum SensorAccuracyType {
    38   SENSOR_ACCURACY_UNKNOWN = -1,
    39   SENSOR_ACCURACY_UNRELIABLE,
    40   SENSOR_ACCURACY_LOW,
    41   SENSOR_ACCURACY_MED,
    42   SENSOR_ACCURACY_HIGH,
    43   NUM_SENSOR_ACCURACY_TYPE
    44 };
    46 class SensorAccuracy;
    48 typedef Observer<SensorAccuracy> ISensorAccuracyObserver;
    50 }
    51 }
    53 #include "ipc/IPCMessageUtils.h"
    55 namespace IPC {
    56   /**
    57    * Serializer for SensorType
    58    */
    59   template <>
    60   struct ParamTraits<mozilla::hal::SensorType>:
    61     public ContiguousEnumSerializer<
    62              mozilla::hal::SensorType,
    63              mozilla::hal::SENSOR_UNKNOWN,
    64              mozilla::hal::NUM_SENSOR_TYPE> {
    65   };
    67   template <>
    68   struct ParamTraits<mozilla::hal::SensorAccuracyType>:
    69     public ContiguousEnumSerializer<
    70              mozilla::hal::SensorAccuracyType,
    71              mozilla::hal::SENSOR_ACCURACY_UNKNOWN,
    72              mozilla::hal::NUM_SENSOR_ACCURACY_TYPE> {
    74   };
    75 } // namespace IPC
    77 #endif /* __HAL_SENSOR_H_ */

mercurial