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.

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

mercurial