Bug 1908539 restrict MacOS platform audio processing to Nightly r=webrtc-reviewers...
[gecko.git] / dom / base / nsCCUncollectableMarker.h
blob2948cc0589dc92fd1b00f045a43989b634369909
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::dom {
43 void TraceBlackJS(JSTracer* aTrc);
44 } // namespace mozilla::dom
46 #endif