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

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

Issue 2097753002: Make memory pressure notifier configurable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win Created 4 years, 5 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
« no previous file with comments | « base/memory/memory_pressure_monitor.h ('k') | base/memory/memory_pressure_monitor_chromeos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 9 #include "base/files/scoped_file.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 ~MemoryPressureMonitor() override; 53 ~MemoryPressureMonitor() override;
54 54
55 // Redo the memory pressure calculation soon and call again if a critical 55 // Redo the memory pressure calculation soon and call again if a critical
56 // memory pressure prevails. Note that this call will trigger an asynchronous 56 // memory pressure prevails. Note that this call will trigger an asynchronous
57 // action which gives the system time to release memory back into the pool. 57 // action which gives the system time to release memory back into the pool.
58 void ScheduleEarlyCheck(); 58 void ScheduleEarlyCheck();
59 59
60 // Get the current memory pressure level. 60 // Get the current memory pressure level.
61 MemoryPressureListener::MemoryPressureLevel GetCurrentPressureLevel() const 61 MemoryPressureListener::MemoryPressureLevel GetCurrentPressureLevel() const
62 override; 62 override;
63 void SetDispatchCallback(const DispatchCallback& callback) override;
63 64
64 // Returns a type-casted version of the current memory pressure monitor. A 65 // Returns a type-casted version of the current memory pressure monitor. A
65 // simple wrapper to base::MemoryPressureMonitor::Get. 66 // simple wrapper to base::MemoryPressureMonitor::Get.
66 static MemoryPressureMonitor* Get(); 67 static MemoryPressureMonitor* Get();
67 68
68 private: 69 private:
69 friend TestMemoryPressureMonitor; 70 friend TestMemoryPressureMonitor;
70 // Starts observing the memory fill level. 71 // Starts observing the memory fill level.
71 // Calls to StartObserving should always be matched with calls to 72 // Calls to StartObserving should always be matched with calls to
72 // StopObserving. 73 // StopObserving.
(...skipping 27 matching lines...) Expand all
100 // gets used to count the number of events since the last event occured. 101 // gets used to count the number of events since the last event occured.
101 int moderate_pressure_repeat_count_; 102 int moderate_pressure_repeat_count_;
102 103
103 // The thresholds for moderate and critical pressure. 104 // The thresholds for moderate and critical pressure.
104 const int moderate_pressure_threshold_percent_; 105 const int moderate_pressure_threshold_percent_;
105 const int critical_pressure_threshold_percent_; 106 const int critical_pressure_threshold_percent_;
106 107
107 // File descriptor used to detect low memory condition. 108 // File descriptor used to detect low memory condition.
108 ScopedFD low_mem_file_; 109 ScopedFD low_mem_file_;
109 110
111 DispatchCallback dispatch_callback_;
112
110 base::WeakPtrFactory<MemoryPressureMonitor> weak_ptr_factory_; 113 base::WeakPtrFactory<MemoryPressureMonitor> weak_ptr_factory_;
111 114
112 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor); 115 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor);
113 }; 116 };
114 117
115 } // namespace chromeos 118 } // namespace chromeos
116 } // namespace base 119 } // namespace base
117 120
118 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_ 121 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_
OLDNEW
« no previous file with comments | « base/memory/memory_pressure_monitor.h ('k') | base/memory/memory_pressure_monitor_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698