content/xul/document/src/nsXULControllers.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 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /*
michael@0 7
michael@0 8 The XUL "controllers" object.
michael@0 9
michael@0 10 */
michael@0 11
michael@0 12 #ifndef nsXULControllers_h__
michael@0 13 #define nsXULControllers_h__
michael@0 14
michael@0 15 #include "nsCOMPtr.h"
michael@0 16 #include "nsTArray.h"
michael@0 17 #include "nsWeakPtr.h"
michael@0 18 #include "nsIControllers.h"
michael@0 19 #include "nsCycleCollectionParticipant.h"
michael@0 20
michael@0 21 /* non-XPCOM class for holding controllers and their IDs */
michael@0 22 class nsXULControllerData
michael@0 23 {
michael@0 24 public:
michael@0 25 nsXULControllerData(uint32_t inControllerID, nsIController* inController)
michael@0 26 : mControllerID(inControllerID)
michael@0 27 , mController(inController)
michael@0 28 {
michael@0 29 }
michael@0 30
michael@0 31 ~nsXULControllerData() {}
michael@0 32
michael@0 33 uint32_t GetControllerID() { return mControllerID; }
michael@0 34
michael@0 35 nsresult GetController(nsIController **outController)
michael@0 36 {
michael@0 37 NS_IF_ADDREF(*outController = mController);
michael@0 38 return NS_OK;
michael@0 39 }
michael@0 40
michael@0 41 uint32_t mControllerID;
michael@0 42 nsCOMPtr<nsIController> mController;
michael@0 43 };
michael@0 44
michael@0 45
michael@0 46 nsresult NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult);
michael@0 47
michael@0 48 class nsXULControllers : public nsIControllers
michael@0 49 {
michael@0 50 public:
michael@0 51 friend nsresult
michael@0 52 NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult);
michael@0 53
michael@0 54 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
michael@0 55 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULControllers, nsIControllers)
michael@0 56 NS_DECL_NSICONTROLLERS
michael@0 57
michael@0 58 protected:
michael@0 59 nsXULControllers();
michael@0 60 virtual ~nsXULControllers(void);
michael@0 61
michael@0 62 void DeleteControllers();
michael@0 63
michael@0 64 nsTArray<nsXULControllerData*> mControllers;
michael@0 65 uint32_t mCurControllerID;
michael@0 66 };
michael@0 67
michael@0 68
michael@0 69
michael@0 70
michael@0 71 #endif // nsXULControllers_h__

mercurial