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