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

Unified Diff: content/browser/memory/memory_monitor_chromeos.cc

Issue 2731273003: Update MemoryMonitorChromeOS (Closed)
Patch Set: comment Created 3 years, 9 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 | « no previous file | content/browser/memory/memory_monitor_chromeos_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/memory/memory_monitor_chromeos.cc
diff --git a/content/browser/memory/memory_monitor_chromeos.cc b/content/browser/memory/memory_monitor_chromeos.cc
index 6dae24735c2c3133658bfbcf478ce39f1c68957e..36d8ff87c9bd7530c9cba891b407a58bf9db62a1 100644
--- a/content/browser/memory/memory_monitor_chromeos.cc
+++ b/content/browser/memory/memory_monitor_chromeos.cc
@@ -25,11 +25,9 @@ int MemoryMonitorChromeOS::GetFreeMemoryUntilCriticalMB() {
base::SystemMemoryInfoKB mem_info = {};
delegate_->GetSystemMemoryInfo(&mem_info);
- // The available memory consists of "real" and virtual (z)ram memory.
- // Since swappable memory uses a non pre-deterministic compression and
- // the compression creates its own "dynamic" in the system, it gets
- // de-emphasized by the |kSwapWeight| factor.
- const int kSwapWeight = 4;
+ // Use available free memory provided by the OS if the OS supports it.
+ if (mem_info.available > 0)
+ return mem_info.available >> kShiftKiBtoMiB;
// The kernel internally uses 50MB.
const int kMinFileMemory = 50 * 1024;
@@ -39,9 +37,8 @@ int MemoryMonitorChromeOS::GetFreeMemoryUntilCriticalMB() {
// unless it is dirty or it's a minimal portion which is required.
file_memory -= mem_info.dirty + kMinFileMemory;
- // Available memory is the sum of free, swap and easy reclaimable memory.
- return (mem_info.free + mem_info.swap_free / kSwapWeight + file_memory) >>
- kShiftKiBtoMiB;
+ // Available memory is the sum of free and easy reclaimable memory.
+ return (mem_info.free + file_memory) >> kShiftKiBtoMiB;
}
// static
« no previous file with comments | « no previous file | content/browser/memory/memory_monitor_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698