xpcom/glue/nsCycleCollectionTraversalCallback.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.

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 nsCycleCollectionTraversalCallback_h__
michael@0 7 #define nsCycleCollectionTraversalCallback_h__
michael@0 8
michael@0 9 #include "nsISupports.h"
michael@0 10
michael@0 11 class nsCycleCollectionParticipant;
michael@0 12
michael@0 13 class NS_NO_VTABLE nsCycleCollectionTraversalCallback
michael@0 14 {
michael@0 15 public:
michael@0 16 // You must call DescribeRefCountedNode() with an accurate
michael@0 17 // refcount, otherwise cycle collection will fail, and probably crash.
michael@0 18 // If the callback cares about objname, it should put
michael@0 19 // WANT_DEBUG_INFO in mFlags.
michael@0 20 NS_IMETHOD_(void) DescribeRefCountedNode(nsrefcnt refcount,
michael@0 21 const char* objname) = 0;
michael@0 22 // Note, aCompartmentAddress is 0 if it is unknown.
michael@0 23 NS_IMETHOD_(void) DescribeGCedNode(bool ismarked,
michael@0 24 const char* objname,
michael@0 25 uint64_t aCompartmentAddress = 0) = 0;
michael@0 26
michael@0 27 NS_IMETHOD_(void) NoteXPCOMChild(nsISupports *child) = 0;
michael@0 28 NS_IMETHOD_(void) NoteJSChild(void *child) = 0;
michael@0 29 NS_IMETHOD_(void) NoteNativeChild(void *child,
michael@0 30 nsCycleCollectionParticipant *helper) = 0;
michael@0 31
michael@0 32 // Give a name to the edge associated with the next call to
michael@0 33 // NoteXPCOMChild, NoteJSChild, or NoteNativeChild.
michael@0 34 // Callbacks who care about this should set WANT_DEBUG_INFO in the
michael@0 35 // flags.
michael@0 36 NS_IMETHOD_(void) NoteNextEdgeName(const char* name) = 0;
michael@0 37
michael@0 38 enum {
michael@0 39 // Values for flags:
michael@0 40
michael@0 41 // Caller should call NoteNextEdgeName and pass useful objName
michael@0 42 // to DescribeRefCountedNode and DescribeGCedNode.
michael@0 43 WANT_DEBUG_INFO = (1<<0),
michael@0 44
michael@0 45 // Caller should not skip objects that we know will be
michael@0 46 // uncollectable.
michael@0 47 WANT_ALL_TRACES = (1<<1)
michael@0 48 };
michael@0 49 uint32_t Flags() const { return mFlags; }
michael@0 50 bool WantDebugInfo() const { return (mFlags & WANT_DEBUG_INFO) != 0; }
michael@0 51 bool WantAllTraces() const { return (mFlags & WANT_ALL_TRACES) != 0; }
michael@0 52 protected:
michael@0 53 nsCycleCollectionTraversalCallback() : mFlags(0) {}
michael@0 54
michael@0 55 uint32_t mFlags;
michael@0 56 };
michael@0 57
michael@0 58 #endif // nsCycleCollectionTraversalCallback_h__

mercurial