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.

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

mercurial