LCOV - code coverage report
Current view: top level - xpcom/base - nsMemory.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 5 16 31.2 %
Date: 2017-07-14 16:53:18 Functions: 1 3 33.3 %
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             : #include "nsXPCOM.h"
       8             : #include "nsMemory.h"
       9             : #include "nsIMemory.h"
      10             : #include "nsXPCOMPrivate.h"
      11             : #include "nsDebug.h"
      12             : #include "nsISupportsUtils.h"
      13             : #include "nsCOMPtr.h"
      14             : 
      15             : ////////////////////////////////////////////////////////////////////////////////
      16             : // nsMemory static helper routines
      17             : 
      18             : nsresult
      19           0 : nsMemory::HeapMinimize(bool aImmediate)
      20             : {
      21           0 :   nsCOMPtr<nsIMemory> mem;
      22           0 :   nsresult rv = NS_GetMemoryManager(getter_AddRefs(mem));
      23           0 :   if (NS_WARN_IF(NS_FAILED(rv))) {
      24           0 :     return rv;
      25             :   }
      26             : 
      27           0 :   return mem->HeapMinimize(aImmediate);
      28             : }
      29             : 
      30             : void*
      31        6319 : nsMemory::Clone(const void* aPtr, size_t aSize)
      32             : {
      33        6319 :   void* newPtr = NS_Alloc(aSize);
      34        6319 :   if (newPtr) {
      35        6319 :     memcpy(newPtr, aPtr, aSize);
      36             :   }
      37        6319 :   return newPtr;
      38             : }
      39             : 
      40             : nsIMemory*
      41           0 : nsMemory::GetGlobalMemoryService()
      42             : {
      43             :   nsIMemory* mem;
      44           0 :   nsresult rv = NS_GetMemoryManager(&mem);
      45           0 :   if (NS_FAILED(rv)) {
      46           0 :     return nullptr;
      47             :   }
      48             : 
      49           0 :   return mem;
      50             : }
      51             : 
      52             : //----------------------------------------------------------------------
      53             : 

Generated by: LCOV version 1.13