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.

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

mercurial