Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/xpcom/base/nsCycleCollectionNoteChild.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
// This header will be included by headers that define refpointer and array classes
8
// in order to specialize CC helpers such as ImplCycleCollectionTraverse for them.
9
10
#ifndef nsCycleCollectionNoteChild_h__
11
#define nsCycleCollectionNoteChild_h__
12
13
#include "nsCycleCollectionTraversalCallback.h"
14
#include "mozilla/Likely.h"
15
#include "mozilla/TypeTraits.h"
16
17
enum
18
{
19
  CycleCollectionEdgeNameArrayFlag = 1
20
};
21
22
// Just a helper for appending "[i]". Didn't want to pull in string headers here.
23
void
24
CycleCollectionNoteEdgeNameImpl(nsCycleCollectionTraversalCallback& aCallback,
25
                                const char* aName,
26
                                uint32_t aFlags = 0);
27
28
// Should be inlined so that in the no-debug-info case this is just a simple if().
29
MOZ_ALWAYS_INLINE void
30
CycleCollectionNoteEdgeName(nsCycleCollectionTraversalCallback& aCallback,
31
                            const char* aName,
32
                            uint32_t aFlags = 0)
33
0
{
34
0
  if (MOZ_UNLIKELY(aCallback.WantDebugInfo())) {
35
0
    CycleCollectionNoteEdgeNameImpl(aCallback, aName, aFlags);
36
0
  }
37
0
}
Unexecuted instantiation: CycleCollectionNoteEdgeName(nsCycleCollectionTraversalCallback&, char const*, unsigned int)
Unexecuted instantiation: CycleCollectionNoteEdgeName(nsCycleCollectionTraversalCallback&, char const*, unsigned int)
38
39
#define NS_CYCLE_COLLECTION_INNERCLASS                                         \
40
        cycleCollection
41
42
#define NS_CYCLE_COLLECTION_INNERNAME                                          \
43
0
        _cycleCollectorGlobal
44
45
#define NS_CYCLE_COLLECTION_PARTICIPANT(_class)                                \
46
0
        _class::NS_CYCLE_COLLECTION_INNERCLASS::GetParticipant()
47
48
template<typename T>
49
nsISupports*
50
ToSupports(T* aPtr, typename T::NS_CYCLE_COLLECTION_INNERCLASS* aDummy = 0)
51
0
{
52
0
  return T::NS_CYCLE_COLLECTION_INNERCLASS::Upcast(aPtr);
53
0
}
Unexecuted instantiation: nsISupports* ToSupports<mozilla::dom::CallbackObject>(mozilla::dom::CallbackObject*, mozilla::dom::CallbackObject::cycleCollection*)
Unexecuted instantiation: nsISupports* ToSupports<mozilla::dom::LifecycleAdoptedCallback>(mozilla::dom::LifecycleAdoptedCallback*, mozilla::dom::LifecycleAdoptedCallback::cycleCollection*)
Unexecuted instantiation: nsISupports* ToSupports<mozilla::dom::LifecycleAttributeChangedCallback>(mozilla::dom::LifecycleAttributeChangedCallback*, mozilla::dom::LifecycleAttributeChangedCallback::cycleCollection*)
Unexecuted instantiation: nsISupports* ToSupports<mozilla::dom::LifecycleConnectedCallback>(mozilla::dom::LifecycleConnectedCallback*, mozilla::dom::LifecycleConnectedCallback::cycleCollection*)
Unexecuted instantiation: nsISupports* ToSupports<mozilla::dom::LifecycleDisconnectedCallback>(mozilla::dom::LifecycleDisconnectedCallback*, mozilla::dom::LifecycleDisconnectedCallback::cycleCollection*)
Unexecuted instantiation: nsISupports* ToSupports<mozilla::dom::LifecycleGetCustomInterfaceCallback>(mozilla::dom::LifecycleGetCustomInterfaceCallback*, mozilla::dom::LifecycleGetCustomInterfaceCallback::cycleCollection*)
Unexecuted instantiation: nsISupports* ToSupports<mozilla::dom::ProcessMessageManager>(mozilla::dom::ProcessMessageManager*, mozilla::dom::ProcessMessageManager::cycleCollection*)
Unexecuted instantiation: nsISupports* ToSupports<mozilla::dom::TabChildMessageManager>(mozilla::dom::TabChildMessageManager*, mozilla::dom::TabChildMessageManager::cycleCollection*)
Unexecuted instantiation: nsISupports* ToSupports<mozilla::dom::TabChild>(mozilla::dom::TabChild*, mozilla::dom::TabChild::cycleCollection*)
54
55
// The default implementation of this class template is empty, because it
56
// should never be used: see the partial specializations below.
57
template<typename T,
58
         bool IsXPCOM = mozilla::IsBaseOf<nsISupports, T>::value>
59
struct CycleCollectionNoteChildImpl
60
{
61
};
62
63
template<typename T>
64
struct CycleCollectionNoteChildImpl<T, true>
65
{
66
  static void Run(nsCycleCollectionTraversalCallback& aCallback, T* aChild)
67
0
  {
68
0
    aCallback.NoteXPCOMChild(ToSupports(aChild));
69
0
  }
Unexecuted instantiation: CycleCollectionNoteChildImpl<mozilla::dom::LifecycleAdoptedCallback, true>::Run(nsCycleCollectionTraversalCallback&, mozilla::dom::LifecycleAdoptedCallback*)
Unexecuted instantiation: CycleCollectionNoteChildImpl<mozilla::dom::LifecycleAttributeChangedCallback, true>::Run(nsCycleCollectionTraversalCallback&, mozilla::dom::LifecycleAttributeChangedCallback*)
Unexecuted instantiation: CycleCollectionNoteChildImpl<mozilla::dom::LifecycleConnectedCallback, true>::Run(nsCycleCollectionTraversalCallback&, mozilla::dom::LifecycleConnectedCallback*)
Unexecuted instantiation: CycleCollectionNoteChildImpl<mozilla::dom::LifecycleDisconnectedCallback, true>::Run(nsCycleCollectionTraversalCallback&, mozilla::dom::LifecycleDisconnectedCallback*)
Unexecuted instantiation: CycleCollectionNoteChildImpl<mozilla::dom::LifecycleGetCustomInterfaceCallback, true>::Run(nsCycleCollectionTraversalCallback&, mozilla::dom::LifecycleGetCustomInterfaceCallback*)
Unexecuted instantiation: CycleCollectionNoteChildImpl<mozilla::dom::TabChildMessageManager, true>::Run(nsCycleCollectionTraversalCallback&, mozilla::dom::TabChildMessageManager*)
Unexecuted instantiation: CycleCollectionNoteChildImpl<nsIWebBrowserChrome3, true>::Run(nsCycleCollectionTraversalCallback&, nsIWebBrowserChrome3*)
Unexecuted instantiation: CycleCollectionNoteChildImpl<nsIWebNavigation, true>::Run(nsCycleCollectionTraversalCallback&, nsIWebNavigation*)
Unexecuted instantiation: CycleCollectionNoteChildImpl<mozilla::dom::TabChild, true>::Run(nsCycleCollectionTraversalCallback&, mozilla::dom::TabChild*)
70
};
71
72
template<typename T>
73
struct CycleCollectionNoteChildImpl<T, false>
74
{
75
  static void Run(nsCycleCollectionTraversalCallback& aCallback, T* aChild)
76
  {
77
    aCallback.NoteNativeChild(aChild, NS_CYCLE_COLLECTION_PARTICIPANT(T));
78
  }
79
};
80
81
// We declare CycleCollectionNoteChild in 3-argument and 4-argument variants,
82
// rather than using default arguments, so that forward declarations work
83
// regardless of header inclusion order.
84
template<typename T>
85
inline void
86
CycleCollectionNoteChild(nsCycleCollectionTraversalCallback& aCallback,
87
                         T* aChild, const char* aName, uint32_t aFlags)
88
0
{
89
0
  CycleCollectionNoteEdgeName(aCallback, aName, aFlags);
90
0
  CycleCollectionNoteChildImpl<T>::Run(aCallback, aChild);
91
0
}
Unexecuted instantiation: void CycleCollectionNoteChild<mozilla::dom::LifecycleAdoptedCallback>(nsCycleCollectionTraversalCallback&, mozilla::dom::LifecycleAdoptedCallback*, char const*, unsigned int)
Unexecuted instantiation: void CycleCollectionNoteChild<mozilla::dom::LifecycleAttributeChangedCallback>(nsCycleCollectionTraversalCallback&, mozilla::dom::LifecycleAttributeChangedCallback*, char const*, unsigned int)
Unexecuted instantiation: void CycleCollectionNoteChild<mozilla::dom::LifecycleConnectedCallback>(nsCycleCollectionTraversalCallback&, mozilla::dom::LifecycleConnectedCallback*, char const*, unsigned int)
Unexecuted instantiation: void CycleCollectionNoteChild<mozilla::dom::LifecycleDisconnectedCallback>(nsCycleCollectionTraversalCallback&, mozilla::dom::LifecycleDisconnectedCallback*, char const*, unsigned int)
Unexecuted instantiation: void CycleCollectionNoteChild<mozilla::dom::LifecycleGetCustomInterfaceCallback>(nsCycleCollectionTraversalCallback&, mozilla::dom::LifecycleGetCustomInterfaceCallback*, char const*, unsigned int)
Unexecuted instantiation: void CycleCollectionNoteChild<mozilla::dom::TabChildMessageManager>(nsCycleCollectionTraversalCallback&, mozilla::dom::TabChildMessageManager*, char const*, unsigned int)
Unexecuted instantiation: void CycleCollectionNoteChild<nsIWebBrowserChrome3>(nsCycleCollectionTraversalCallback&, nsIWebBrowserChrome3*, char const*, unsigned int)
Unexecuted instantiation: void CycleCollectionNoteChild<nsIWebNavigation>(nsCycleCollectionTraversalCallback&, nsIWebNavigation*, char const*, unsigned int)
Unexecuted instantiation: void CycleCollectionNoteChild<mozilla::dom::TabChild>(nsCycleCollectionTraversalCallback&, mozilla::dom::TabChild*, char const*, unsigned int)
92
93
template<typename T>
94
inline void
95
CycleCollectionNoteChild(nsCycleCollectionTraversalCallback& aCallback,
96
                         T* aChild, const char* aName)
97
{
98
  CycleCollectionNoteChild(aCallback, aChild, aName, 0);
99
}
100
101
#endif // nsCycleCollectionNoteChild_h__