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