content/base/src/nsCCUncollectableMarker.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 nsCCUncollectableMarker_h_
     7 #define nsCCUncollectableMarker_h_
     9 #include "js/TracingAPI.h"
    10 #include "mozilla/Attributes.h"
    11 #include "nsIObserver.h"
    13 class nsCCUncollectableMarker MOZ_FINAL : public nsIObserver
    14 {
    15   NS_DECL_ISUPPORTS
    16   NS_DECL_NSIOBSERVER
    18   /**
    19    * Inits a global nsCCUncollectableMarker. Should only be called once.
    20    */
    21   static nsresult Init();
    23   /**
    24    * Checks if we're collecting during a given generation
    25    */
    26   static bool InGeneration(uint32_t aGeneration)
    27   {
    28     return aGeneration && aGeneration == sGeneration;
    29   }
    31   template <class CCCallback>
    32   static bool InGeneration(CCCallback& aCb, uint32_t aGeneration)
    33   {
    34     return InGeneration(aGeneration) && !aCb.WantAllTraces();
    35   }
    37   static uint32_t sGeneration;
    39 private:
    40   nsCCUncollectableMarker() {}
    42 };
    44 namespace mozilla {
    45 namespace dom {
    46 void TraceBlackJS(JSTracer* aTrc, uint32_t aGCNumber, bool aIsShutdownGC);
    47 }
    48 }
    50 #endif

mercurial