xpcom/base/nsCycleCollector.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:a3546de75fd8
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #ifndef nsCycleCollector_h__
7 #define nsCycleCollector_h__
8
9 class nsICycleCollectorListener;
10 class nsISupports;
11
12 #include "nsError.h"
13 #include "nsID.h"
14
15 namespace mozilla {
16
17 class CycleCollectedJSRuntime;
18
19 // See the comments in nsContentUtils.h for explanations of these functions.
20 typedef void* (*DeferredFinalizeAppendFunction)(void* pointers, void* thing);
21 typedef bool (*DeferredFinalizeFunction)(uint32_t slice, void* data);
22
23 }
24
25 bool nsCycleCollector_init();
26
27 void nsCycleCollector_startup();
28
29 typedef void (*CC_BeforeUnlinkCallback)(void);
30 void nsCycleCollector_setBeforeUnlinkCallback(CC_BeforeUnlinkCallback aCB);
31
32 typedef void (*CC_ForgetSkippableCallback)(void);
33 void nsCycleCollector_setForgetSkippableCallback(CC_ForgetSkippableCallback aCB);
34
35 void nsCycleCollector_forgetSkippable(bool aRemoveChildlessNodes = false,
36 bool aAsyncSnowWhiteFreeing = false);
37
38 void nsCycleCollector_prepareForGarbageCollection();
39
40 void nsCycleCollector_dispatchDeferredDeletion(bool aContinuation = false);
41 bool nsCycleCollector_doDeferredDeletion();
42
43 void nsCycleCollector_collect(nsICycleCollectorListener *aManualListener);
44
45 // If aSliceTime is negative, the CC will run to completion. If aSliceTime
46 // is 0, only a minimum quantum of work will be done. Otherwise, aSliceTime
47 // will be used as the time budget for the slice, in ms.
48 void nsCycleCollector_collectSlice(int64_t aSliceTime);
49
50 uint32_t nsCycleCollector_suspectedCount();
51 void nsCycleCollector_shutdown();
52
53 // Helpers for interacting with JS
54 void nsCycleCollector_registerJSRuntime(mozilla::CycleCollectedJSRuntime *aRt);
55 void nsCycleCollector_forgetJSRuntime();
56
57 #define NS_CYCLE_COLLECTOR_LOGGER_CID \
58 { 0x58be81b4, 0x39d2, 0x437c, \
59 { 0x94, 0xea, 0xae, 0xde, 0x2c, 0x62, 0x08, 0xd3 } }
60
61 extern nsresult
62 nsCycleCollectorLoggerConstructor(nsISupports* outer,
63 const nsIID& aIID,
64 void* *aInstancePtr);
65
66 namespace mozilla {
67 namespace cyclecollector {
68
69 #ifdef DEBUG
70 bool IsJSHolder(void* aHolder);
71 #endif
72
73 void DeferredFinalize(DeferredFinalizeAppendFunction aAppendFunc,
74 DeferredFinalizeFunction aFunc,
75 void* aThing);
76 void DeferredFinalize(nsISupports* aSupports);
77
78
79 } // namespace cyclecollector
80 } // namespace mozilla
81
82 #endif // nsCycleCollector_h__

mercurial