Bug 1690340 - Part 4: Insert the "Page Source" before the "Extensions for Developers...
[gecko.git] / xpcom / base / nsMemory.cpp
bloba9c7b2fc63d33169fb8bd00b9f3dfdfd5eb5028f
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/. */
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"
15 ////////////////////////////////////////////////////////////////////////////////
16 // nsMemory static helper routines
18 nsresult nsMemory::HeapMinimize(bool aImmediate) {
19 nsCOMPtr<nsIMemory> mem;
20 nsresult rv = NS_GetMemoryManager(getter_AddRefs(mem));
21 if (NS_WARN_IF(NS_FAILED(rv))) {
22 return rv;
25 return mem->HeapMinimize(aImmediate);
28 nsIMemory* nsMemory::GetGlobalMemoryService() {
29 nsIMemory* mem;
30 nsresult rv = NS_GetMemoryManager(&mem);
31 if (NS_FAILED(rv)) {
32 return nullptr;
35 return mem;
38 //----------------------------------------------------------------------