Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/MemoryMonitorAndroid.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/MemoryMonitorAndroid.java b/content/public/android/java/src/org/chromium/content/browser/MemoryMonitorAndroid.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9053da8927fd739279c81716afc09ea1aa60a9f9 |
| --- /dev/null |
| +++ b/content/public/android/java/src/org/chromium/content/browser/MemoryMonitorAndroid.java |
| @@ -0,0 +1,26 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.content.browser; |
| + |
| +import android.app.ActivityManager; |
| +import android.content.Context; |
| + |
| +import org.chromium.base.annotations.CalledByNative; |
| +import org.chromium.base.annotations.JNINamespace; |
| + |
| +/** |
| + * Android implementation of MemoryMonitor. |
| + */ |
| +@JNINamespace("content") |
| +class MemoryMonitorAndroid { |
| + @CalledByNative |
| + private static ActivityManager.MemoryInfo getMemoryInfo(Context context) { |
| + ActivityManager am = (ActivityManager) context.getSystemService( |
| + Context.ACTIVITY_SERVICE); |
| + ActivityManager.MemoryInfo info = new ActivityManager.MemoryInfo(); |
|
boliu
2016/09/27 03:00:23
actually, to avoid gc churn, can you save this obj
bashi
2016/09/27 03:51:36
Done. It's still unclear how much we call this fun
|
| + am.getMemoryInfo(info); |
| + return info; |
| + } |
| +} |