Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef nsXBLDocumentInfo_h__
8 : #define nsXBLDocumentInfo_h__
9 :
10 : #include "mozilla/Attributes.h"
11 : #include "nsCOMPtr.h"
12 : #include "nsAutoPtr.h"
13 : #include "nsWeakReference.h"
14 : #include "nsIDocument.h"
15 : #include "nsCycleCollectionParticipant.h"
16 :
17 : class nsXBLPrototypeBinding;
18 :
19 : class nsXBLDocumentInfo final : public nsSupportsWeakReference
20 : {
21 : public:
22 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
23 :
24 : explicit nsXBLDocumentInfo(nsIDocument* aDocument);
25 :
26 685 : nsIDocument* GetDocument() const { return mDocument; }
27 :
28 2052 : bool GetScriptAccess() const { return mScriptAccess; }
29 :
30 933 : nsIURI* DocumentURI() { return mDocument->GetDocumentURI(); }
31 :
32 : nsXBLPrototypeBinding* GetPrototypeBinding(const nsACString& aRef);
33 : nsresult SetPrototypeBinding(const nsACString& aRef,
34 : nsXBLPrototypeBinding* aBinding);
35 :
36 : // This removes the binding without deleting it
37 : void RemovePrototypeBinding(const nsACString& aRef);
38 :
39 : nsresult WritePrototypeBindings();
40 :
41 : void SetFirstPrototypeBinding(nsXBLPrototypeBinding* aBinding);
42 :
43 : void FlushSkinStylesheets();
44 :
45 162 : bool IsChrome() { return mIsChrome; }
46 :
47 : void MarkInCCGeneration(uint32_t aGeneration);
48 :
49 : static nsresult ReadPrototypeBindings(nsIURI* aURI, nsXBLDocumentInfo** aDocInfo,
50 : nsIDocument* aBoundDocument);
51 :
52 3495 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsXBLDocumentInfo)
53 :
54 : private:
55 : virtual ~nsXBLDocumentInfo();
56 :
57 : nsCOMPtr<nsIDocument> mDocument;
58 : bool mScriptAccess;
59 : bool mIsChrome;
60 : // the binding table owns each nsXBLPrototypeBinding
61 : nsAutoPtr<nsClassHashtable<nsCStringHashKey, nsXBLPrototypeBinding>> mBindingTable;
62 :
63 : // non-owning pointer to the first binding in the table
64 : nsXBLPrototypeBinding* mFirstBinding;
65 : };
66 :
67 : #ifdef DEBUG
68 : void AssertInCompilationScope();
69 : #else
70 : inline void AssertInCompilationScope() {}
71 : #endif
72 :
73 : #endif
|