Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/xbl/nsXBLDocumentInfo.h
Line
Count
Source (jump to first uncovered line)
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 "mozilla/MemoryReporting.h"
12
#include "nsCOMPtr.h"
13
#include "nsAutoPtr.h"
14
#include "nsWeakReference.h"
15
#include "nsIDocument.h"
16
#include "nsCycleCollectionParticipant.h"
17
18
class nsXBLPrototypeBinding;
19
20
class nsXBLDocumentInfo final : public nsSupportsWeakReference
21
{
22
public:
23
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
24
25
  explicit nsXBLDocumentInfo(nsIDocument* aDocument);
26
27
0
  nsIDocument* GetDocument() const { return mDocument; }
28
29
0
  bool GetScriptAccess() const { return mScriptAccess; }
30
31
0
  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
0
  bool IsChrome() { return mIsChrome; }
47
48
  void MarkInCCGeneration(uint32_t aGeneration);
49
50
  static nsresult ReadPrototypeBindings(nsIURI* aURI, nsXBLDocumentInfo** aDocInfo,
51
                                        nsIDocument* aBoundDocument);
52
53
  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
54
55
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsXBLDocumentInfo)
56
57
private:
58
  virtual ~nsXBLDocumentInfo();
59
60
  nsCOMPtr<nsIDocument> mDocument;
61
  bool mScriptAccess;
62
  bool mIsChrome;
63
  // the binding table owns each nsXBLPrototypeBinding
64
  nsAutoPtr<nsClassHashtable<nsCStringHashKey, nsXBLPrototypeBinding>> mBindingTable;
65
66
  // non-owning pointer to the first binding in the table
67
  nsXBLPrototypeBinding* mFirstBinding;
68
};
69
70
#ifdef DEBUG
71
void AssertInCompilationScope();
72
#else
73
0
inline void AssertInCompilationScope() {}
74
#endif
75
76
#endif