dom/xbl/nsXBLDocumentInfo.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:5ec4f0d40392
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/. */
4
5 #ifndef nsXBLDocumentInfo_h__
6 #define nsXBLDocumentInfo_h__
7
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"
14
15 class nsXBLPrototypeBinding;
16 class nsXBLDocGlobalObject;
17
18 class nsXBLDocumentInfo MOZ_FINAL : public nsSupportsWeakReference
19 {
20 public:
21 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
22
23 nsXBLDocumentInfo(nsIDocument* aDocument);
24 virtual ~nsXBLDocumentInfo();
25
26 already_AddRefed<nsIDocument> GetDocument()
27 { nsCOMPtr<nsIDocument> copy = mDocument; return copy.forget(); }
28
29 bool GetScriptAccess() const { return mScriptAccess; }
30
31 nsIURI* DocumentURI() { return mDocument->GetDocumentURI(); }
32
33 nsXBLPrototypeBinding* GetPrototypeBinding(const nsACString& aRef);
34 nsresult SetPrototypeBinding(const nsACString& aRef,
35 nsXBLPrototypeBinding* aBinding);
36
37 // This removes the binding without deleting it
38 void RemovePrototypeBinding(const nsACString& aRef);
39
40 nsresult WritePrototypeBindings();
41
42 void SetFirstPrototypeBinding(nsXBLPrototypeBinding* aBinding);
43
44 void FlushSkinStylesheets();
45
46 bool IsChrome() { return mIsChrome; }
47
48 void MarkInCCGeneration(uint32_t aGeneration);
49
50 static nsresult ReadPrototypeBindings(nsIURI* aURI, nsXBLDocumentInfo** aDocInfo);
51
52 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsXBLDocumentInfo)
53
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;
60
61 // non-owning pointer to the first binding in the table
62 nsXBLPrototypeBinding* mFirstBinding;
63 };
64
65 #ifdef DEBUG
66 void AssertInCompilationScope();
67 #else
68 inline void AssertInCompilationScope() {}
69 #endif
70
71 #endif

mercurial