Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1539)

Unified Diff: content/browser/memory/memory_monitor_android.h

Issue 2340293003: Add MemoryMonitorAndroid (Closed)
Patch Set: rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/android/browser_jni_registrar.cc ('k') | content/browser/memory/memory_monitor_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/memory/memory_monitor_android.h
diff --git a/content/browser/memory/memory_monitor_android.h b/content/browser/memory/memory_monitor_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..abd7824c1ae42ab86977fdb4af3b57db71c8f702
--- /dev/null
+++ b/content/browser/memory/memory_monitor_android.h
@@ -0,0 +1,45 @@
+// 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.
+
+#ifndef CONTENT_BROWSER_MEMORY_MEMORY_MONITOR_ANDROID_H_
+#define CONTENT_BROWSER_MEMORY_MEMORY_MONITOR_ANDROID_H_
+
+#include <jni.h>
+
+#include "content/browser/memory/memory_monitor.h"
+
+namespace content {
+
+// A memory monitor for the Android system.
+class CONTENT_EXPORT MemoryMonitorAndroid : public MemoryMonitor {
+ public:
+ static std::unique_ptr<MemoryMonitorAndroid> Create();
+
+ static bool Register(JNIEnv* env);
+
+ // C++ counter-part of ActivityManager.MemoryInfo
+ struct MemoryInfo {
+ jlong avail_mem;
+ jboolean low_memory;
+ jlong threshold;
+ jlong total_mem;
+ };
+
+ ~MemoryMonitorAndroid() override;
+
+ // MemoryMonitor implementation:
+ int GetFreeMemoryUntilCriticalMB() override;
+
+ // Get memory info from the Android system.
+ void GetMemoryInfo(MemoryInfo* out);
+
+ private:
+ MemoryMonitorAndroid();
+
+ DISALLOW_COPY_AND_ASSIGN(MemoryMonitorAndroid);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_MEMORY_MEMORY_MONITOR_ANDROID_H_
« no previous file with comments | « content/browser/android/browser_jni_registrar.cc ('k') | content/browser/memory/memory_monitor_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698