Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsCCUncollectableMarker_h_
7 #define nsCCUncollectableMarker_h_
9 #include "js/TracingAPI.h"
10 #include "mozilla/Attributes.h"
11 #include "nsIObserver.h"
13 class nsCCUncollectableMarker MOZ_FINAL : public nsIObserver
14 {
15 NS_DECL_ISUPPORTS
16 NS_DECL_NSIOBSERVER
18 /**
19 * Inits a global nsCCUncollectableMarker. Should only be called once.
20 */
21 static nsresult Init();
23 /**
24 * Checks if we're collecting during a given generation
25 */
26 static bool InGeneration(uint32_t aGeneration)
27 {
28 return aGeneration && aGeneration == sGeneration;
29 }
31 template <class CCCallback>
32 static bool InGeneration(CCCallback& aCb, uint32_t aGeneration)
33 {
34 return InGeneration(aGeneration) && !aCb.WantAllTraces();
35 }
37 static uint32_t sGeneration;
39 private:
40 nsCCUncollectableMarker() {}
42 };
44 namespace mozilla {
45 namespace dom {
46 void TraceBlackJS(JSTracer* aTrc, uint32_t aGCNumber, bool aIsShutdownGC);
47 }
48 }
50 #endif