Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef nsXBLDocumentInfo_h__ |
michael@0 | 6 | #define nsXBLDocumentInfo_h__ |
michael@0 | 7 | |
michael@0 | 8 | #include "mozilla/Attributes.h" |
michael@0 | 9 | #include "nsCOMPtr.h" |
michael@0 | 10 | #include "nsAutoPtr.h" |
michael@0 | 11 | #include "nsWeakReference.h" |
michael@0 | 12 | #include "nsIDocument.h" |
michael@0 | 13 | #include "nsCycleCollectionParticipant.h" |
michael@0 | 14 | |
michael@0 | 15 | class nsXBLPrototypeBinding; |
michael@0 | 16 | class nsXBLDocGlobalObject; |
michael@0 | 17 | |
michael@0 | 18 | class nsXBLDocumentInfo MOZ_FINAL : public nsSupportsWeakReference |
michael@0 | 19 | { |
michael@0 | 20 | public: |
michael@0 | 21 | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
michael@0 | 22 | |
michael@0 | 23 | nsXBLDocumentInfo(nsIDocument* aDocument); |
michael@0 | 24 | virtual ~nsXBLDocumentInfo(); |
michael@0 | 25 | |
michael@0 | 26 | already_AddRefed<nsIDocument> GetDocument() |
michael@0 | 27 | { nsCOMPtr<nsIDocument> copy = mDocument; return copy.forget(); } |
michael@0 | 28 | |
michael@0 | 29 | bool GetScriptAccess() const { return mScriptAccess; } |
michael@0 | 30 | |
michael@0 | 31 | nsIURI* DocumentURI() { return mDocument->GetDocumentURI(); } |
michael@0 | 32 | |
michael@0 | 33 | nsXBLPrototypeBinding* GetPrototypeBinding(const nsACString& aRef); |
michael@0 | 34 | nsresult SetPrototypeBinding(const nsACString& aRef, |
michael@0 | 35 | nsXBLPrototypeBinding* aBinding); |
michael@0 | 36 | |
michael@0 | 37 | // This removes the binding without deleting it |
michael@0 | 38 | void RemovePrototypeBinding(const nsACString& aRef); |
michael@0 | 39 | |
michael@0 | 40 | nsresult WritePrototypeBindings(); |
michael@0 | 41 | |
michael@0 | 42 | void SetFirstPrototypeBinding(nsXBLPrototypeBinding* aBinding); |
michael@0 | 43 | |
michael@0 | 44 | void FlushSkinStylesheets(); |
michael@0 | 45 | |
michael@0 | 46 | bool IsChrome() { return mIsChrome; } |
michael@0 | 47 | |
michael@0 | 48 | void MarkInCCGeneration(uint32_t aGeneration); |
michael@0 | 49 | |
michael@0 | 50 | static nsresult ReadPrototypeBindings(nsIURI* aURI, nsXBLDocumentInfo** aDocInfo); |
michael@0 | 51 | |
michael@0 | 52 | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsXBLDocumentInfo) |
michael@0 | 53 | |
michael@0 | 54 | private: |
michael@0 | 55 | nsCOMPtr<nsIDocument> mDocument; |
michael@0 | 56 | bool mScriptAccess; |
michael@0 | 57 | bool mIsChrome; |
michael@0 | 58 | // the binding table owns each nsXBLPrototypeBinding |
michael@0 | 59 | nsAutoPtr<nsClassHashtable<nsCStringHashKey, nsXBLPrototypeBinding>> mBindingTable; |
michael@0 | 60 | |
michael@0 | 61 | // non-owning pointer to the first binding in the table |
michael@0 | 62 | nsXBLPrototypeBinding* mFirstBinding; |
michael@0 | 63 | }; |
michael@0 | 64 | |
michael@0 | 65 | #ifdef DEBUG |
michael@0 | 66 | void AssertInCompilationScope(); |
michael@0 | 67 | #else |
michael@0 | 68 | inline void AssertInCompilationScope() {} |
michael@0 | 69 | #endif |
michael@0 | 70 | |
michael@0 | 71 | #endif |