/work/obj-fuzz/dist/include/mozilla/RootedRefPtr.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 file, |
5 | | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | /** |
8 | | * An implementation of Rooted for RefPtr<T>. This works by assuming that T has |
9 | | * a Trace() method defined on it which will trace whatever things inside the T |
10 | | * instance need tracing. |
11 | | * |
12 | | * This implementation has one serious drawback: operator= doesn't work right |
13 | | * because it's declared on Rooted directly and expects the type Rooted is |
14 | | * templated over. |
15 | | */ |
16 | | |
17 | | #ifndef mozilla_RootedRefPtr_h__ |
18 | | #define mozilla_RootedRefPtr_h__ |
19 | | |
20 | | #include "mozilla/RefPtr.h" |
21 | | #include "js/GCPolicyAPI.h" |
22 | | #include "js/RootingAPI.h" |
23 | | |
24 | | namespace JS { |
25 | | template<typename T> |
26 | | struct GCPolicy<RefPtr<T>> |
27 | | { |
28 | | static RefPtr<T> initial() { |
29 | | return RefPtr<T>(); |
30 | | } |
31 | | |
32 | | static void trace(JSTracer* trc, RefPtr<T>* tp, const char* name) |
33 | 0 | { |
34 | 0 | if (*tp) { |
35 | 0 | (*tp)->Trace(trc); |
36 | 0 | } |
37 | 0 | } Unexecuted instantiation: JS::GCPolicy<RefPtr<mozilla::dom::binding_detail::FastEventHandlerNonNull> >::trace(JSTracer*, RefPtr<mozilla::dom::binding_detail::FastEventHandlerNonNull>*, char const*) Unexecuted instantiation: JS::GCPolicy<RefPtr<mozilla::dom::binding_detail::FastEventListener> >::trace(JSTracer*, RefPtr<mozilla::dom::binding_detail::FastEventListener>*, char const*) Unexecuted instantiation: JS::GCPolicy<RefPtr<mozilla::dom::binding_detail::FastOnErrorEventHandlerNonNull> >::trace(JSTracer*, RefPtr<mozilla::dom::binding_detail::FastOnErrorEventHandlerNonNull>*, char const*) Unexecuted instantiation: JS::GCPolicy<RefPtr<mozilla::dom::binding_detail::FastOnBeforeUnloadEventHandlerNonNull> >::trace(JSTracer*, RefPtr<mozilla::dom::binding_detail::FastOnBeforeUnloadEventHandlerNonNull>*, char const*) Unexecuted instantiation: JS::GCPolicy<RefPtr<mozilla::dom::binding_detail::FastAnyCallback> >::trace(JSTracer*, RefPtr<mozilla::dom::binding_detail::FastAnyCallback>*, char const*) Unexecuted instantiation: JS::GCPolicy<RefPtr<mozilla::dom::binding_detail::FastXPathNSResolver> >::trace(JSTracer*, RefPtr<mozilla::dom::binding_detail::FastXPathNSResolver>*, char const*) Unexecuted instantiation: JS::GCPolicy<RefPtr<mozilla::dom::binding_detail::FastFunctionStringCallback> >::trace(JSTracer*, RefPtr<mozilla::dom::binding_detail::FastFunctionStringCallback>*, char const*) Unexecuted instantiation: JS::GCPolicy<RefPtr<mozilla::dom::binding_detail::FastNodeFilter> >::trace(JSTracer*, RefPtr<mozilla::dom::binding_detail::FastNodeFilter>*, char const*) Unexecuted instantiation: JS::GCPolicy<RefPtr<mozilla::dom::binding_detail::FastPositionErrorCallback> >::trace(JSTracer*, RefPtr<mozilla::dom::binding_detail::FastPositionErrorCallback>*, char const*) Unexecuted instantiation: JS::GCPolicy<RefPtr<mozilla::dom::binding_detail::FastPrintCallback> >::trace(JSTracer*, RefPtr<mozilla::dom::binding_detail::FastPrintCallback>*, char const*) |
38 | | }; |
39 | | } // namespace JS |
40 | | |
41 | | namespace js { |
42 | | template<typename T, typename Wrapper> |
43 | | struct WrappedPtrOperations<RefPtr<T>, Wrapper> |
44 | | { |
45 | | operator T*() const |
46 | 0 | { |
47 | 0 | return static_cast<const Wrapper*>(this)->get(); |
48 | 0 | } Unexecuted instantiation: js::WrappedPtrOperations<RefPtr<mozilla::dom::binding_detail::FastEventHandlerNonNull>, JS::Rooted<RefPtr<mozilla::dom::binding_detail::FastEventHandlerNonNull> > >::operator mozilla::dom::binding_detail::FastEventHandlerNonNull*() const Unexecuted instantiation: js::WrappedPtrOperations<RefPtr<mozilla::dom::binding_detail::FastEventListener>, JS::Rooted<RefPtr<mozilla::dom::binding_detail::FastEventListener> > >::operator mozilla::dom::binding_detail::FastEventListener*() const Unexecuted instantiation: js::WrappedPtrOperations<RefPtr<mozilla::dom::binding_detail::FastOnErrorEventHandlerNonNull>, JS::Rooted<RefPtr<mozilla::dom::binding_detail::FastOnErrorEventHandlerNonNull> > >::operator mozilla::dom::binding_detail::FastOnErrorEventHandlerNonNull*() const Unexecuted instantiation: js::WrappedPtrOperations<RefPtr<mozilla::dom::binding_detail::FastOnBeforeUnloadEventHandlerNonNull>, JS::Rooted<RefPtr<mozilla::dom::binding_detail::FastOnBeforeUnloadEventHandlerNonNull> > >::operator mozilla::dom::binding_detail::FastOnBeforeUnloadEventHandlerNonNull*() const Unexecuted instantiation: js::WrappedPtrOperations<RefPtr<mozilla::dom::binding_detail::FastAnyCallback>, JS::Rooted<RefPtr<mozilla::dom::binding_detail::FastAnyCallback> > >::operator mozilla::dom::binding_detail::FastAnyCallback*() const Unexecuted instantiation: js::WrappedPtrOperations<RefPtr<mozilla::dom::binding_detail::FastXPathNSResolver>, JS::Rooted<RefPtr<mozilla::dom::binding_detail::FastXPathNSResolver> > >::operator mozilla::dom::binding_detail::FastXPathNSResolver*() const Unexecuted instantiation: js::WrappedPtrOperations<RefPtr<mozilla::dom::binding_detail::FastFunctionStringCallback>, JS::Rooted<RefPtr<mozilla::dom::binding_detail::FastFunctionStringCallback> > >::operator mozilla::dom::binding_detail::FastFunctionStringCallback*() const Unexecuted instantiation: js::WrappedPtrOperations<RefPtr<mozilla::dom::binding_detail::FastNodeFilter>, JS::Rooted<RefPtr<mozilla::dom::binding_detail::FastNodeFilter> > >::operator mozilla::dom::binding_detail::FastNodeFilter*() const Unexecuted instantiation: js::WrappedPtrOperations<RefPtr<mozilla::dom::binding_detail::FastPositionErrorCallback>, JS::Rooted<RefPtr<mozilla::dom::binding_detail::FastPositionErrorCallback> > >::operator mozilla::dom::binding_detail::FastPositionErrorCallback*() const Unexecuted instantiation: js::WrappedPtrOperations<RefPtr<mozilla::dom::binding_detail::FastPrintCallback>, JS::Rooted<RefPtr<mozilla::dom::binding_detail::FastPrintCallback> > >::operator mozilla::dom::binding_detail::FastPrintCallback*() const |
49 | | }; |
50 | | } // namespace js |
51 | | |
52 | | #endif /* mozilla_RootedRefPtr_h__ */ |