LCOV - code coverage report
Current view: top level - xpcom/base - nsMemoryImpl.h (source / functions) Hit Total Coverage
Test: output.info Lines: 4 4 100.0 %
Date: 2017-07-14 16:53:18 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef nsMemoryImpl_h__
       8             : #define nsMemoryImpl_h__
       9             : 
      10             : #include "mozilla/Atomics.h"
      11             : 
      12             : #include "nsIMemory.h"
      13             : #include "nsIRunnable.h"
      14             : 
      15             : // nsMemoryImpl is a static object. We can do this because it doesn't have
      16             : // a constructor/destructor or any instance members. Please don't add
      17             : // instance member variables, only static member variables.
      18             : 
      19             : class nsMemoryImpl : public nsIMemory
      20             : {
      21             : public:
      22             :   // We don't use the generic macros because we are a special static object
      23             :   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aResult) override;
      24           5 :   NS_IMETHOD_(MozExternalRefCountType) AddRef(void) override
      25             :   {
      26           5 :     return 1;
      27             :   }
      28           2 :   NS_IMETHOD_(MozExternalRefCountType) Release(void) override
      29             :   {
      30           2 :     return 1;
      31             :   }
      32             : 
      33             :   NS_DECL_NSIMEMORY
      34             : 
      35             :   static nsresult Create(nsISupports* aOuter,
      36             :                          const nsIID& aIID, void** aResult);
      37             : 
      38             :   nsresult FlushMemory(const char16_t* aReason, bool aImmediate);
      39             :   nsresult RunFlushers(const char16_t* aReason);
      40             : 
      41             : protected:
      42             :   struct FlushEvent : public nsIRunnable
      43             :   {
      44             :     constexpr FlushEvent() : mReason(nullptr) {}
      45             :     NS_DECL_ISUPPORTS_INHERITED
      46             :     NS_DECL_NSIRUNNABLE
      47             :     const char16_t* mReason;
      48             :   };
      49             : 
      50             :   static mozilla::Atomic<bool> sIsFlushing;
      51             :   static FlushEvent sFlushEvent;
      52             :   static PRIntervalTime sLastFlushTime;
      53             : };
      54             : 
      55             : #endif // nsMemoryImpl_h__

Generated by: LCOV version 1.13