dom/alarm/AlarmHalService.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 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef mozilla_dom_alarm_AlarmHalService_h
     6 #define mozilla_dom_alarm_AlarmHalService_h
     8 #include "base/basictypes.h"
     9 #include "mozilla/ClearOnShutdown.h"
    10 #include "mozilla/StaticPtr.h"
    11 #include "mozilla/Hal.h"
    12 #include "mozilla/Services.h"
    13 #include "nsIAlarmHalService.h"
    14 #include "nsIObserver.h"
    15 #include "nsIObserverService.h"
    17 namespace mozilla {
    18 namespace dom {
    19 namespace alarm {
    21 typedef Observer<void_t> AlarmObserver;
    22 typedef Observer<hal::SystemTimezoneChangeInformation> SystemTimezoneChangeObserver;
    24 class AlarmHalService : public nsIAlarmHalService, 
    25                         public AlarmObserver,
    26                         public SystemTimezoneChangeObserver
    27 {
    28 public:
    29   NS_DECL_ISUPPORTS
    30   NS_DECL_NSIALARMHALSERVICE
    32   void Init();
    33   virtual ~AlarmHalService();
    35   static already_AddRefed<AlarmHalService> GetInstance();
    37   // Implementing hal::AlarmObserver
    38   void Notify(const void_t& aVoid);
    40   // Implementing hal::SystemTimezoneChangeObserver
    41   void Notify(const hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo);
    43 private:
    44   bool mAlarmEnabled;
    45   static StaticRefPtr<AlarmHalService> sSingleton;
    47   nsCOMPtr<nsIAlarmFiredCb> mAlarmFiredCb;
    48   nsCOMPtr<nsITimezoneChangedCb> mTimezoneChangedCb;
    49 };
    51 } // namespace alarm
    52 } // namespace dom
    53 } // namespace mozilla
    55 #endif // mozilla_dom_alarm_AlarmHalService_h

mercurial