michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsCCUncollectableMarker_h_ michael@0: #define nsCCUncollectableMarker_h_ michael@0: michael@0: #include "js/TracingAPI.h" michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsIObserver.h" michael@0: michael@0: class nsCCUncollectableMarker MOZ_FINAL : public nsIObserver michael@0: { michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIOBSERVER michael@0: michael@0: /** michael@0: * Inits a global nsCCUncollectableMarker. Should only be called once. michael@0: */ michael@0: static nsresult Init(); michael@0: michael@0: /** michael@0: * Checks if we're collecting during a given generation michael@0: */ michael@0: static bool InGeneration(uint32_t aGeneration) michael@0: { michael@0: return aGeneration && aGeneration == sGeneration; michael@0: } michael@0: michael@0: template michael@0: static bool InGeneration(CCCallback& aCb, uint32_t aGeneration) michael@0: { michael@0: return InGeneration(aGeneration) && !aCb.WantAllTraces(); michael@0: } michael@0: michael@0: static uint32_t sGeneration; michael@0: michael@0: private: michael@0: nsCCUncollectableMarker() {} michael@0: michael@0: }; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: void TraceBlackJS(JSTracer* aTrc, uint32_t aGCNumber, bool aIsShutdownGC); michael@0: } michael@0: } michael@0: michael@0: #endif