xpcom/glue/nsCycleCollectionTraversalCallback.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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