xpcom/base/nsCycleCollector.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     6 #ifndef nsCycleCollector_h__
     7 #define nsCycleCollector_h__
     9 class nsICycleCollectorListener;
    10 class nsISupports;
    12 #include "nsError.h"
    13 #include "nsID.h"
    15 namespace mozilla {
    17 class CycleCollectedJSRuntime;
    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);
    23 }
    25 bool nsCycleCollector_init();
    27 void nsCycleCollector_startup();
    29 typedef void (*CC_BeforeUnlinkCallback)(void);
    30 void nsCycleCollector_setBeforeUnlinkCallback(CC_BeforeUnlinkCallback aCB);
    32 typedef void (*CC_ForgetSkippableCallback)(void);
    33 void nsCycleCollector_setForgetSkippableCallback(CC_ForgetSkippableCallback aCB);
    35 void nsCycleCollector_forgetSkippable(bool aRemoveChildlessNodes = false,
    36                                       bool aAsyncSnowWhiteFreeing = false);
    38 void nsCycleCollector_prepareForGarbageCollection();
    40 void nsCycleCollector_dispatchDeferredDeletion(bool aContinuation = false);
    41 bool nsCycleCollector_doDeferredDeletion();
    43 void nsCycleCollector_collect(nsICycleCollectorListener *aManualListener);
    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);
    50 uint32_t nsCycleCollector_suspectedCount();
    51 void nsCycleCollector_shutdown();
    53 // Helpers for interacting with JS
    54 void nsCycleCollector_registerJSRuntime(mozilla::CycleCollectedJSRuntime *aRt);
    55 void nsCycleCollector_forgetJSRuntime();
    57 #define NS_CYCLE_COLLECTOR_LOGGER_CID \
    58 { 0x58be81b4, 0x39d2, 0x437c, \
    59 { 0x94, 0xea, 0xae, 0xde, 0x2c, 0x62, 0x08, 0xd3 } }
    61 extern nsresult
    62 nsCycleCollectorLoggerConstructor(nsISupports* outer,
    63                                   const nsIID& aIID,
    64                                   void* *aInstancePtr);
    66 namespace mozilla {
    67 namespace cyclecollector {
    69 #ifdef DEBUG
    70 bool IsJSHolder(void* aHolder);
    71 #endif
    73 void DeferredFinalize(DeferredFinalizeAppendFunction aAppendFunc,
    74                       DeferredFinalizeFunction aFunc,
    75                       void* aThing);
    76 void DeferredFinalize(nsISupports* aSupports);
    79 } // namespace cyclecollector
    80 } // namespace mozilla
    82 #endif // nsCycleCollector_h__

mercurial