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