2015-05-03 12:32:37 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-05-07 16:45:25 -07:00
|
|
|
|
2012-11-19 17:05:34 -08:00
|
|
|
#ifndef nsCCUncollectableMarker_h_
|
|
|
|
#define nsCCUncollectableMarker_h_
|
|
|
|
|
2014-04-11 15:19:05 -07:00
|
|
|
#include "js/TracingAPI.h"
|
2012-06-18 19:30:09 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-04-11 15:19:05 -07:00
|
|
|
#include "nsIObserver.h"
|
2012-03-27 12:22:10 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
class nsCCUncollectableMarker final : public nsIObserver
|
2007-05-07 16:45:25 -07:00
|
|
|
{
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Inits a global nsCCUncollectableMarker. Should only be called once.
|
|
|
|
*/
|
|
|
|
static nsresult Init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if we're collecting during a given generation
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
static bool InGeneration(uint32_t aGeneration)
|
2012-01-26 07:03:21 -08:00
|
|
|
{
|
|
|
|
return aGeneration && aGeneration == sGeneration;
|
|
|
|
}
|
|
|
|
|
2013-05-20 13:08:11 -07:00
|
|
|
template <class CCCallback>
|
|
|
|
static bool InGeneration(CCCallback& aCb, uint32_t aGeneration)
|
2012-01-26 07:03:21 -08:00
|
|
|
{
|
2012-03-27 12:22:10 -07:00
|
|
|
return InGeneration(aGeneration) && !aCb.WantAllTraces();
|
2007-05-07 16:45:25 -07:00
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
static uint32_t sGeneration;
|
2007-05-07 16:45:25 -07:00
|
|
|
|
|
|
|
private:
|
2007-06-16 12:53:59 -07:00
|
|
|
nsCCUncollectableMarker() {}
|
2014-06-24 19:09:15 -07:00
|
|
|
~nsCCUncollectableMarker() {}
|
2007-05-07 16:45:25 -07:00
|
|
|
};
|
2012-03-27 12:22:10 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2013-03-19 10:20:21 -07:00
|
|
|
void TraceBlackJS(JSTracer* aTrc, uint32_t aGCNumber, bool aIsShutdownGC);
|
2015-07-13 08:25:42 -07:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2012-11-19 17:05:34 -08:00
|
|
|
|
|
|
|
#endif
|