widget/qt/nsIdleServiceQt.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: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* vim:expandtab:shiftwidth=4:tabstop=4:
     3  */
     4 /* This Source Code Form is subject to the terms of the Mozilla Public
     5  * License, v. 2.0. If a copy of the MPL was not distributed with this
     6  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     8 #ifndef nsIdleServiceQt_h__
     9 #define nsIdleServiceQt_h__
    11 #include "nsIdleService.h"
    13 #if defined(MOZ_X11)
    14 #include <X11/Xlib.h>
    15 #include <X11/Xutil.h>
    17 typedef struct {
    18     Window window;              // Screen saver window
    19     int state;                  // ScreenSaver(Off,On,Disabled)
    20     int kind;                   // ScreenSaver(Blanked,Internal,External)
    21     unsigned long til_or_since; // milliseconds since/til screensaver kicks in
    22     unsigned long idle;         // milliseconds idle
    23     unsigned long event_mask;   // event stuff
    24 } XScreenSaverInfo;
    25 #endif
    27 class nsIdleServiceQt : public nsIdleService
    28 {
    29 public:
    30     NS_DECL_ISUPPORTS_INHERITED
    32     bool PollIdleTime(uint32_t* aIdleTime);
    34     static already_AddRefed<nsIdleServiceQt> GetInstance()
    35     {
    36         nsRefPtr<nsIdleServiceQt> idleService =
    37             nsIdleService::GetInstance().downcast<nsIdleServiceQt>();
    38         if (!idleService) {
    39             idleService = new nsIdleServiceQt();
    40         }
    42         return idleService.forget();
    43     }
    45 private:
    46 #if defined(MOZ_X11)
    47     XScreenSaverInfo* mXssInfo;
    48 #endif
    50 protected:
    51     nsIdleServiceQt();
    52     virtual ~nsIdleServiceQt();
    53     bool UsePollMode();
    54 };
    56 #endif // nsIdleServiceQt_h__

mercurial