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