2007-01-05 01:31:26 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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-01-05 01:31:26 +03:00
|
|
|
|
|
|
|
#ifndef nsCycleCollector_h__
|
|
|
|
#define nsCycleCollector_h__
|
|
|
|
|
2010-08-12 04:03:23 +04:00
|
|
|
class nsICycleCollectorListener;
|
2013-04-30 21:41:22 +04:00
|
|
|
class nsISupports;
|
2007-01-05 01:31:26 +03:00
|
|
|
|
2013-07-09 18:28:15 +04:00
|
|
|
#include "nsError.h"
|
|
|
|
#include "nsID.h"
|
|
|
|
|
2013-06-18 23:02:16 +04:00
|
|
|
namespace mozilla {
|
2013-07-09 18:28:15 +04:00
|
|
|
|
2013-06-18 23:02:16 +04:00
|
|
|
class CycleCollectedJSRuntime;
|
2013-07-09 18:28:15 +04:00
|
|
|
|
|
|
|
// See the comments in nsContentUtils.h for explanations of these functions.
|
|
|
|
typedef void* (*DeferredFinalizeAppendFunction)(void* pointers, void* thing);
|
|
|
|
typedef bool (*DeferredFinalizeFunction)(uint32_t slice, void* data);
|
|
|
|
|
2013-06-18 23:02:16 +04:00
|
|
|
}
|
|
|
|
|
2013-03-26 01:26:00 +04:00
|
|
|
bool nsCycleCollector_init();
|
|
|
|
|
2013-08-13 21:45:32 +04:00
|
|
|
void nsCycleCollector_startup();
|
2012-01-14 20:58:05 +04:00
|
|
|
|
|
|
|
typedef void (*CC_BeforeUnlinkCallback)(void);
|
|
|
|
void nsCycleCollector_setBeforeUnlinkCallback(CC_BeforeUnlinkCallback aCB);
|
|
|
|
|
|
|
|
typedef void (*CC_ForgetSkippableCallback)(void);
|
|
|
|
void nsCycleCollector_setForgetSkippableCallback(CC_ForgetSkippableCallback aCB);
|
|
|
|
|
2013-07-27 14:48:45 +04:00
|
|
|
void nsCycleCollector_forgetSkippable(bool aRemoveChildlessNodes = false,
|
|
|
|
bool aAsyncSnowWhiteFreeing = false);
|
2012-01-14 20:58:05 +04:00
|
|
|
|
2013-12-06 22:17:20 +04:00
|
|
|
void nsCycleCollector_prepareForGarbageCollection();
|
|
|
|
|
2014-05-07 04:25:26 +04:00
|
|
|
// If an incremental cycle collection is in progress, finish it.
|
|
|
|
void nsCycleCollector_finishAnyCurrentCollection();
|
|
|
|
|
2013-08-04 03:55:39 +04:00
|
|
|
void nsCycleCollector_dispatchDeferredDeletion(bool aContinuation = false);
|
|
|
|
bool nsCycleCollector_doDeferredDeletion();
|
2013-07-09 21:30:58 +04:00
|
|
|
|
2014-05-13 21:41:38 +04:00
|
|
|
void nsCycleCollector_collect(nsICycleCollectorListener* aManualListener);
|
2013-12-22 18:58:19 +04:00
|
|
|
|
2014-05-07 04:25:26 +04:00
|
|
|
// If aSliceTime is negative, the CC will run to completion. Otherwise,
|
|
|
|
// aSliceTime will be used as the time budget for the slice, in ms.
|
2014-01-01 23:00:35 +04:00
|
|
|
void nsCycleCollector_collectSlice(int64_t aSliceTime);
|
2013-11-21 02:35:17 +04:00
|
|
|
|
2014-05-07 04:25:26 +04:00
|
|
|
// If aSliceTime is negative, the CC will run to completion. Otherwise,
|
|
|
|
// aSliceTime will be used as the work budget for the slice.
|
|
|
|
void nsCycleCollector_collectSliceWork(int64_t aSliceWork);
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t nsCycleCollector_suspectedCount();
|
2007-03-27 13:49:06 +04:00
|
|
|
void nsCycleCollector_shutdown();
|
2007-01-05 01:31:26 +03:00
|
|
|
|
2012-05-03 23:28:11 +04:00
|
|
|
// Helpers for interacting with JS
|
2014-05-13 21:41:38 +04:00
|
|
|
void nsCycleCollector_registerJSRuntime(mozilla::CycleCollectedJSRuntime* aRt);
|
2012-05-03 23:28:11 +04:00
|
|
|
void nsCycleCollector_forgetJSRuntime();
|
|
|
|
|
2010-08-12 04:03:23 +04:00
|
|
|
#define NS_CYCLE_COLLECTOR_LOGGER_CID \
|
|
|
|
{ 0x58be81b4, 0x39d2, 0x437c, \
|
|
|
|
{ 0x94, 0xea, 0xae, 0xde, 0x2c, 0x62, 0x08, 0xd3 } }
|
|
|
|
|
|
|
|
extern nsresult
|
2014-05-13 21:41:38 +04:00
|
|
|
nsCycleCollectorLoggerConstructor(nsISupports* aOuter,
|
2010-08-12 04:03:23 +04:00
|
|
|
const nsIID& aIID,
|
2014-05-13 21:41:38 +04:00
|
|
|
void** aInstancePtr);
|
2010-08-12 04:03:23 +04:00
|
|
|
|
2013-06-18 23:01:26 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace cyclecollector {
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2013-08-15 21:29:02 +04:00
|
|
|
bool IsJSHolder(void* aHolder);
|
2013-06-18 23:01:26 +04:00
|
|
|
#endif
|
|
|
|
|
2013-07-09 18:28:15 +04:00
|
|
|
void DeferredFinalize(DeferredFinalizeAppendFunction aAppendFunc,
|
|
|
|
DeferredFinalizeFunction aFunc,
|
|
|
|
void* aThing);
|
|
|
|
void DeferredFinalize(nsISupports* aSupports);
|
|
|
|
|
|
|
|
|
2013-06-18 23:01:26 +04:00
|
|
|
} // namespace cyclecollector
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2007-01-05 01:31:26 +03:00
|
|
|
#endif // nsCycleCollector_h__
|