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

Side by Side Diff: base/memory/memory_pressure_monitor_chromeos.h

Issue 2783613002: WIP: memory coordinator: Check /dev/chromeos-low-mem to determine memory condition
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_ 5 #ifndef BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_
6 #define BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_ 6 #define BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/files/scoped_file.h"
10 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/low_memory_observer_chromeos.h"
11 #include "base/memory/memory_pressure_listener.h" 11 #include "base/memory/memory_pressure_listener.h"
12 #include "base/memory/memory_pressure_monitor.h" 12 #include "base/memory/memory_pressure_monitor.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
15 15
16 namespace base { 16 namespace base {
17 namespace chromeos { 17 namespace chromeos {
18 18
19 class TestMemoryPressureMonitor; 19 class TestMemoryPressureMonitor;
20 20
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // 5 seconds, but the timer to report "ChromeOS.MemoryPressureLevel" 105 // 5 seconds, but the timer to report "ChromeOS.MemoryPressureLevel"
106 // fires every second. This counter is used to allow reporting 106 // fires every second. This counter is used to allow reporting
107 // "Memory.PressureLevel" correctly without adding another 107 // "Memory.PressureLevel" correctly without adding another
108 // timer. 108 // timer.
109 int seconds_since_reporting_; 109 int seconds_since_reporting_;
110 110
111 // The thresholds for moderate and critical pressure. 111 // The thresholds for moderate and critical pressure.
112 const int moderate_pressure_threshold_percent_; 112 const int moderate_pressure_threshold_percent_;
113 const int critical_pressure_threshold_percent_; 113 const int critical_pressure_threshold_percent_;
114 114
115 // File descriptor used to detect low memory condition. 115 // To detect low memory condition.
116 ScopedFD low_mem_file_; 116 std::unique_ptr<LowMemoryObserver> low_mem_observer_;
117 117
118 DispatchCallback dispatch_callback_; 118 DispatchCallback dispatch_callback_;
119 119
120 base::WeakPtrFactory<MemoryPressureMonitor> weak_ptr_factory_; 120 base::WeakPtrFactory<MemoryPressureMonitor> weak_ptr_factory_;
121 121
122 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor); 122 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor);
123 }; 123 };
124 124
125 } // namespace chromeos 125 } // namespace chromeos
126 } // namespace base 126 } // namespace base
127 127
128 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_ 128 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_
OLDNEW
« no previous file with comments | « base/memory/low_memory_observer_chromeos.cc ('k') | base/memory/memory_pressure_monitor_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698