Bug 1660051 [wpt PR 25111] - Origin isolation: expand getter test coverage, a=testonly
[gecko.git] / dom / base / nsCCUncollectableMarker.h
blobc003e129ef7d6e0655144a91dd788435475ebdce
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/. */
7 #ifndef nsCCUncollectableMarker_h_
8 #define nsCCUncollectableMarker_h_
10 #include "js/TracingAPI.h"
11 #include "mozilla/Attributes.h"
12 #include "nsIObserver.h"
14 class nsCCUncollectableMarker final : public nsIObserver {
15 NS_DECL_ISUPPORTS
16 NS_DECL_NSIOBSERVER
18 /**
19 * Inits a global nsCCUncollectableMarker. Should only be called once.
21 static nsresult Init();
23 /**
24 * Checks if we're collecting during a given generation
26 static bool InGeneration(uint32_t aGeneration) {
27 return aGeneration && aGeneration == sGeneration;
30 template <class CCCallback>
31 static bool InGeneration(CCCallback& aCb, uint32_t aGeneration) {
32 return InGeneration(aGeneration) && !aCb.WantAllTraces();
35 static uint32_t sGeneration;
37 private:
38 nsCCUncollectableMarker() = default;
39 ~nsCCUncollectableMarker() = default;
42 namespace mozilla {
43 namespace dom {
44 void TraceBlackJS(JSTracer* aTrc, bool aIsShutdownGC);
45 } // namespace dom
46 } // namespace mozilla
48 #endif