/src/mozilla-central/xpcom/base/nsMemory.cpp
Line | Count | Source (jump to first uncovered line) |
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 | | nsMemory::HeapMinimize(bool aImmediate) |
20 | 0 | { |
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 | 0 | } |
26 | 0 | |
27 | 0 | return mem->HeapMinimize(aImmediate); |
28 | 0 | } |
29 | | |
30 | | nsIMemory* |
31 | | nsMemory::GetGlobalMemoryService() |
32 | 0 | { |
33 | 0 | nsIMemory* mem; |
34 | 0 | nsresult rv = NS_GetMemoryManager(&mem); |
35 | 0 | if (NS_FAILED(rv)) { |
36 | 0 | return nullptr; |
37 | 0 | } |
38 | 0 | |
39 | 0 | return mem; |
40 | 0 | } |
41 | | |
42 | | //---------------------------------------------------------------------- |
43 | | |