/work/obj-fuzz/dist/include/mozilla/ArenaRefPtrInlines.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 | | |
8 | | /* inline methods that belong in ArenaRefPtr.h, except that they require |
9 | | the inclusion of headers for all types that ArenaRefPtr can handle */ |
10 | | |
11 | | #ifndef mozilla_ArenaRefPtrInlines_h |
12 | | #define mozilla_ArenaRefPtrInlines_h |
13 | | |
14 | | #include "mozilla/ArenaObjectID.h" |
15 | | #include "mozilla/Assertions.h" |
16 | | #include "mozilla/ComputedStyle.h" |
17 | | #include "nsPresArena.h" |
18 | | #include "nsStyleStruct.h" |
19 | | |
20 | | namespace mozilla { |
21 | | |
22 | | template<typename T> |
23 | | void |
24 | | ArenaRefPtr<T>::AssertValidType() |
25 | 0 | { |
26 | 0 | // If adding new types, please update nsPresArena::ClearArenaRefPtrWithoutDeregistering |
27 | 0 | // as well |
28 | 0 | static_assert(IsSame<T, ComputedStyle>::value, |
29 | 0 | "ArenaRefPtr<T> template parameter T must be declared in " |
30 | 0 | "nsPresArenaObjectList and explicitly handled in" |
31 | 0 | "nsPresArena.cpp"); |
32 | 0 | } |
33 | | |
34 | | } // namespace mozilla |
35 | | |
36 | | template<typename T> |
37 | | void |
38 | | nsPresArena::RegisterArenaRefPtr(mozilla::ArenaRefPtr<T>* aPtr) |
39 | 0 | { |
40 | 0 | MOZ_ASSERT(!mArenaRefPtrs.Contains(aPtr)); |
41 | 0 | mArenaRefPtrs.Put(aPtr, T::ArenaObjectID()); |
42 | 0 | } |
43 | | |
44 | | |
45 | | #endif |