2007-05-07 23:45:25 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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 23:45:25 +00:00
|
|
|
|
2012-11-20 01:05:34 +00:00
|
|
|
#ifndef nsCCUncollectableMarker_h_
|
|
|
|
#define nsCCUncollectableMarker_h_
|
|
|
|
|
2014-04-11 22:19:05 +00:00
|
|
|
#include "js/TracingAPI.h"
|
2012-06-19 02:30:09 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-04-11 22:19:05 +00:00
|
|
|
#include "nsIObserver.h"
|
2012-03-27 19:22:10 +00:00
|
|
|
|
2012-06-19 02:30:09 +00:00
|
|
|
class nsCCUncollectableMarker MOZ_FINAL : public nsIObserver
|
2007-05-07 23:45:25 +00: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 15:56:38 +00:00
|
|
|
static bool InGeneration(uint32_t aGeneration)
|
2012-01-26 15:03:21 +00:00
|
|
|
{
|
|
|
|
return aGeneration && aGeneration == sGeneration;
|
|
|
|
}
|
|
|
|
|
2013-05-20 20:08:11 +00:00
|
|
|
template <class CCCallback>
|
|
|
|
static bool InGeneration(CCCallback& aCb, uint32_t aGeneration)
|
2012-01-26 15:03:21 +00:00
|
|
|
{
|
2012-03-27 19:22:10 +00:00
|
|
|
return InGeneration(aGeneration) && !aCb.WantAllTraces();
|
2007-05-07 23:45:25 +00:00
|
|
|
}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
static uint32_t sGeneration;
|
2007-05-07 23:45:25 +00:00
|
|
|
|
|
|
|
private:
|
2007-06-16 19:53:59 +00:00
|
|
|
nsCCUncollectableMarker() {}
|
2014-06-25 02:09:15 +00:00
|
|
|
~nsCCUncollectableMarker() {}
|
2007-05-07 23:45:25 +00:00
|
|
|
};
|
2012-03-27 19:22:10 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2013-03-19 17:20:21 +00:00
|
|
|
void TraceBlackJS(JSTracer* aTrc, uint32_t aGCNumber, bool aIsShutdownGC);
|
2012-03-27 19:22:10 +00:00
|
|
|
}
|
|
|
|
}
|
2012-11-20 01:05:34 +00:00
|
|
|
|
|
|
|
#endif
|