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: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
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 | #ifndef nsTransactionItem_h__ |
michael@0 | 7 | #define nsTransactionItem_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsCOMPtr.h" |
michael@0 | 10 | #include "nsCOMArray.h" |
michael@0 | 11 | #include "nsCycleCollectionParticipant.h" |
michael@0 | 12 | #include "nsISupportsImpl.h" |
michael@0 | 13 | #include "nscore.h" |
michael@0 | 14 | |
michael@0 | 15 | class nsITransaction; |
michael@0 | 16 | class nsTransactionManager; |
michael@0 | 17 | class nsTransactionStack; |
michael@0 | 18 | |
michael@0 | 19 | class nsTransactionItem |
michael@0 | 20 | { |
michael@0 | 21 | nsCOMArray<nsISupports> mData; |
michael@0 | 22 | nsCOMPtr<nsITransaction> mTransaction; |
michael@0 | 23 | nsTransactionStack *mUndoStack; |
michael@0 | 24 | nsTransactionStack *mRedoStack; |
michael@0 | 25 | |
michael@0 | 26 | public: |
michael@0 | 27 | |
michael@0 | 28 | nsTransactionItem(nsITransaction *aTransaction); |
michael@0 | 29 | virtual ~nsTransactionItem(); |
michael@0 | 30 | NS_METHOD_(MozExternalRefCountType) AddRef(); |
michael@0 | 31 | NS_METHOD_(MozExternalRefCountType) Release(); |
michael@0 | 32 | |
michael@0 | 33 | NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsTransactionItem) |
michael@0 | 34 | |
michael@0 | 35 | virtual nsresult AddChild(nsTransactionItem *aTransactionItem); |
michael@0 | 36 | already_AddRefed<nsITransaction> GetTransaction(); |
michael@0 | 37 | virtual nsresult GetIsBatch(bool *aIsBatch); |
michael@0 | 38 | virtual nsresult GetNumberOfChildren(int32_t *aNumChildren); |
michael@0 | 39 | virtual nsresult GetChild(int32_t aIndex, nsTransactionItem **aChild); |
michael@0 | 40 | |
michael@0 | 41 | virtual nsresult DoTransaction(void); |
michael@0 | 42 | virtual nsresult UndoTransaction(nsTransactionManager *aTxMgr); |
michael@0 | 43 | virtual nsresult RedoTransaction(nsTransactionManager *aTxMgr); |
michael@0 | 44 | |
michael@0 | 45 | nsCOMArray<nsISupports>& GetData() |
michael@0 | 46 | { |
michael@0 | 47 | return mData; |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | private: |
michael@0 | 51 | |
michael@0 | 52 | virtual nsresult UndoChildren(nsTransactionManager *aTxMgr); |
michael@0 | 53 | virtual nsresult RedoChildren(nsTransactionManager *aTxMgr); |
michael@0 | 54 | |
michael@0 | 55 | virtual nsresult RecoverFromUndoError(nsTransactionManager *aTxMgr); |
michael@0 | 56 | virtual nsresult RecoverFromRedoError(nsTransactionManager *aTxMgr); |
michael@0 | 57 | |
michael@0 | 58 | virtual nsresult GetNumberOfUndoItems(int32_t *aNumItems); |
michael@0 | 59 | virtual nsresult GetNumberOfRedoItems(int32_t *aNumItems); |
michael@0 | 60 | |
michael@0 | 61 | void CleanUp(); |
michael@0 | 62 | protected: |
michael@0 | 63 | nsCycleCollectingAutoRefCnt mRefCnt; |
michael@0 | 64 | NS_DECL_OWNINGTHREAD |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | #endif // nsTransactionItem_h__ |