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.
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 | #include "nsIRDFDataSource.h" |
michael@0 | 7 | #include "nsIWindowMediatorListener.h" |
michael@0 | 8 | #include "nsIWindowDataSource.h" |
michael@0 | 9 | #include "nsIObserver.h" |
michael@0 | 10 | |
michael@0 | 11 | #include "nsHashKeys.h" |
michael@0 | 12 | #include "nsIRDFService.h" |
michael@0 | 13 | #include "nsIRDFContainer.h" |
michael@0 | 14 | #include "nsInterfaceHashtable.h" |
michael@0 | 15 | #include "nsCycleCollectionParticipant.h" |
michael@0 | 16 | |
michael@0 | 17 | // {C744CA3D-840B-460a-8D70-7CE63C51C958} |
michael@0 | 18 | #define NS_WINDOWDATASOURCE_CID \ |
michael@0 | 19 | { 0xc744ca3d, 0x840b, 0x460a, \ |
michael@0 | 20 | { 0x8d, 0x70, 0x7c, 0xe6, 0x3c, 0x51, 0xc9, 0x58 } } |
michael@0 | 21 | |
michael@0 | 22 | |
michael@0 | 23 | class nsWindowDataSource : public nsIRDFDataSource, |
michael@0 | 24 | public nsIObserver, |
michael@0 | 25 | public nsIWindowMediatorListener, |
michael@0 | 26 | public nsIWindowDataSource |
michael@0 | 27 | { |
michael@0 | 28 | public: |
michael@0 | 29 | nsWindowDataSource() { } |
michael@0 | 30 | virtual ~nsWindowDataSource(); |
michael@0 | 31 | |
michael@0 | 32 | nsresult Init(); |
michael@0 | 33 | |
michael@0 | 34 | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
michael@0 | 35 | NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsWindowDataSource, |
michael@0 | 36 | nsIRDFDataSource) |
michael@0 | 37 | NS_DECL_NSIOBSERVER |
michael@0 | 38 | NS_DECL_NSIWINDOWMEDIATORLISTENER |
michael@0 | 39 | NS_DECL_NSIWINDOWDATASOURCE |
michael@0 | 40 | NS_DECL_NSIRDFDATASOURCE |
michael@0 | 41 | |
michael@0 | 42 | private: |
michael@0 | 43 | |
michael@0 | 44 | // mapping of window -> RDF resource |
michael@0 | 45 | nsInterfaceHashtable<nsPtrHashKey<nsIXULWindow>, nsIRDFResource> mWindowResources; |
michael@0 | 46 | |
michael@0 | 47 | static uint32_t windowCount; |
michael@0 | 48 | static uint32_t gRefCnt; |
michael@0 | 49 | |
michael@0 | 50 | nsCOMPtr<nsIRDFDataSource> mInner; |
michael@0 | 51 | nsCOMPtr<nsIRDFContainer> mContainer; |
michael@0 | 52 | |
michael@0 | 53 | static nsIRDFResource* kNC_Name; |
michael@0 | 54 | static nsIRDFResource* kNC_KeyIndex; |
michael@0 | 55 | static nsIRDFResource* kNC_WindowRoot; |
michael@0 | 56 | static nsIRDFService* gRDFService; |
michael@0 | 57 | }; |