OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_MEMORY_MEMORY_MONITOR_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_MEMORY_MEMORY_MONITOR_ANDROID_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 |
| 10 #include "content/browser/memory/memory_monitor.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 // A memory monitor for the Android system. |
| 15 class CONTENT_EXPORT MemoryMonitorAndroid : public MemoryMonitor { |
| 16 public: |
| 17 static std::unique_ptr<MemoryMonitorAndroid> Create(); |
| 18 |
| 19 static bool Register(JNIEnv* env); |
| 20 |
| 21 // C++ counter-part of ActivityManager.MemoryInfo |
| 22 struct MemoryInfo { |
| 23 jlong avail_mem; |
| 24 jboolean low_memory; |
| 25 jlong threshold; |
| 26 jlong total_mem; |
| 27 }; |
| 28 |
| 29 ~MemoryMonitorAndroid() override; |
| 30 |
| 31 // MemoryMonitor implementation: |
| 32 int GetFreeMemoryUntilCriticalMB() override; |
| 33 |
| 34 // Get memory info from the Android system. |
| 35 void GetMemoryInfo(MemoryInfo* out); |
| 36 |
| 37 private: |
| 38 MemoryMonitorAndroid(); |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(MemoryMonitorAndroid); |
| 41 }; |
| 42 |
| 43 } // namespace content |
| 44 |
| 45 #endif // CONTENT_BROWSER_MEMORY_MEMORY_MONITOR_ANDROID_H_ |
OLD | NEW |