summaryrefslogtreecommitdiffstats
path: root/xpcom/base/nsMemoryImpl.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 21:49:04 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 21:49:04 +0200
commit39dac57259cff8b61db0b22cb2ad0a8adb02692e (patch)
tree52a026cc8c22793eb17fd0f5e22adce1ae08a1dd /xpcom/base/nsMemoryImpl.cpp
parenta1cce3b2b00bbd9f4983013ddd8934a7bccb9e99 (diff)
parentc2d9ab62f3d097c9e0e00184cab1f546554f5eaa (diff)
downloadUXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar
UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.gz
UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.lz
UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.xz
UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.zip
Merge branch 'redwood' into 28.9-platform
Diffstat (limited to 'xpcom/base/nsMemoryImpl.cpp')
-rw-r--r--xpcom/base/nsMemoryImpl.cpp35
1 files changed, 1 insertions, 34 deletions
diff --git a/xpcom/base/nsMemoryImpl.cpp b/xpcom/base/nsMemoryImpl.cpp
index 1d1576fbd..b534e42f5 100644
--- a/xpcom/base/nsMemoryImpl.cpp
+++ b/xpcom/base/nsMemoryImpl.cpp
@@ -14,16 +14,6 @@
#include "nsCOMPtr.h"
#include "mozilla/Services.h"
-#ifdef ANDROID
-#include <stdio.h>
-
-// Minimum memory threshold for a device to be considered
-// a low memory platform. This value has be in sync with
-// Java's equivalent threshold, defined in
-// mobile/android/base/util/HardwareUtils.java
-#define LOW_MEMORY_THRESHOLD_KB (384 * 1024)
-#endif
-
static nsMemoryImpl sGlobalMemory;
NS_IMPL_QUERY_INTERFACE(nsMemoryImpl, nsIMemory)
@@ -37,31 +27,8 @@ nsMemoryImpl::HeapMinimize(bool aImmediate)
NS_IMETHODIMP
nsMemoryImpl::IsLowMemoryPlatform(bool* aResult)
{
-#ifdef ANDROID
- static int sLowMemory = -1; // initialize to unknown, lazily evaluate to 0 or 1
- if (sLowMemory == -1) {
- sLowMemory = 0; // assume "not low memory" in case file operations fail
- *aResult = false;
-
- // check if MemTotal from /proc/meminfo is less than LOW_MEMORY_THRESHOLD_KB
- FILE* fd = fopen("/proc/meminfo", "r");
- if (!fd) {
- return NS_OK;
- }
- uint64_t mem = 0;
- int rv = fscanf(fd, "MemTotal: %llu kB", &mem);
- if (fclose(fd)) {
- return NS_OK;
- }
- if (rv != 1) {
- return NS_OK;
- }
- sLowMemory = (mem < LOW_MEMORY_THRESHOLD_KB) ? 1 : 0;
- }
- *aResult = (sLowMemory == 1);
-#else
*aResult = false;
-#endif
+
return NS_OK;
}