xpcom/base/nsMemoryImpl.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 nsMemoryImpl_h__
     7 #define nsMemoryImpl_h__
     9 #include "mozilla/Atomics.h"
    11 #include "nsIMemory.h"
    12 #include "nsIRunnable.h"
    14 // nsMemoryImpl is a static object. We can do this because it doesn't have
    15 // a constructor/destructor or any instance members. Please don't add
    16 // instance member variables, only static member variables.
    18 class nsMemoryImpl : public nsIMemory
    19 {
    20 public:
    21     // We don't use the generic macros because we are a special static object
    22     NS_IMETHOD QueryInterface(REFNSIID aIID, void** aResult);
    23     NS_IMETHOD_(MozExternalRefCountType) AddRef(void) { return 1; }
    24     NS_IMETHOD_(MozExternalRefCountType) Release(void) { return 1; }
    26     NS_DECL_NSIMEMORY
    28     static nsresult Create(nsISupports* outer,
    29                            const nsIID& aIID, void **aResult);
    31     NS_HIDDEN_(nsresult) FlushMemory(const char16_t* aReason, bool aImmediate);
    32     NS_HIDDEN_(nsresult) RunFlushers(const char16_t* aReason);
    34 protected:
    35     struct FlushEvent : public nsIRunnable {
    36         NS_DECL_ISUPPORTS_INHERITED
    37         NS_DECL_NSIRUNNABLE
    38         const char16_t* mReason;
    39     };
    41     static mozilla::Atomic<bool> sIsFlushing;
    42     static FlushEvent sFlushEvent;
    43     static PRIntervalTime sLastFlushTime;
    44 };
    46 #endif // nsMemoryImpl_h__

mercurial