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

Side by Side Diff: base/chromeos/memory_pressure_observer_chromeos.h

Issue 903273002: Update from https://crrev.com/315085 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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/bind_unittest.nc ('k') | base/chromeos/memory_pressure_observer_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_CHROMEOS_MEMORY_PRESSURE_OBSERVER_CHROMEOS_H_ 5 #ifndef BASE_CHROMEOS_MEMORY_PRESSURE_OBSERVER_CHROMEOS_H_
6 #define BASE_CHROMEOS_MEMORY_PRESSURE_OBSERVER_CHROMEOS_H_ 6 #define BASE_CHROMEOS_MEMORY_PRESSURE_OBSERVER_CHROMEOS_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // Stop observing the memory fill level. 70 // Stop observing the memory fill level.
71 // May be safely called if StartObserving has not been called. 71 // May be safely called if StartObserving has not been called.
72 void StopObserving(); 72 void StopObserving();
73 73
74 // The function which gets periodically called to check any changes in the 74 // The function which gets periodically called to check any changes in the
75 // memory pressure. It will report pressure changes as well as continuous 75 // memory pressure. It will report pressure changes as well as continuous
76 // critical pressure levels. 76 // critical pressure levels.
77 void CheckMemoryPressure(); 77 void CheckMemoryPressure();
78 78
79 // The function periodically checks the memory pressure changes and records
80 // the UMA histogram statistics for the current memory pressure level.
81 void CheckMemoryPressureAndRecordStatistics();
82
79 // Get the memory pressure in percent (virtual for testing). 83 // Get the memory pressure in percent (virtual for testing).
80 virtual int GetUsedMemoryInPercent(); 84 virtual int GetUsedMemoryInPercent();
81 85
82 // The current memory pressure. 86 // The current memory pressure.
83 base::MemoryPressureListener::MemoryPressureLevel 87 base::MemoryPressureListener::MemoryPressureLevel
84 current_memory_pressure_level_; 88 current_memory_pressure_level_;
85 89
86 // A periodic timer to check for resource pressure changes. This will get 90 // A periodic timer to check for resource pressure changes. This will get
87 // replaced by a kernel triggered event system (see crbug.com/381196). 91 // replaced by a kernel triggered event system (see crbug.com/381196).
88 base::RepeatingTimer<MemoryPressureObserverChromeOS> timer_; 92 base::RepeatingTimer<MemoryPressureObserverChromeOS> timer_;
89 93
90 // To slow down the amount of moderate pressure event calls, this counter 94 // To slow down the amount of moderate pressure event calls, this counter
91 // gets used to count the number of events since the last event occured. 95 // gets used to count the number of events since the last event occured.
92 int moderate_pressure_repeat_count_; 96 int moderate_pressure_repeat_count_;
93 97
94 // The thresholds for moderate and critical pressure. 98 // The thresholds for moderate and critical pressure.
95 const int moderate_pressure_threshold_percent_; 99 const int moderate_pressure_threshold_percent_;
96 const int critical_pressure_threshold_percent_; 100 const int critical_pressure_threshold_percent_;
97 101
98 base::WeakPtrFactory<MemoryPressureObserverChromeOS> weak_ptr_factory_; 102 base::WeakPtrFactory<MemoryPressureObserverChromeOS> weak_ptr_factory_;
99 103
100 DISALLOW_COPY_AND_ASSIGN(MemoryPressureObserverChromeOS); 104 DISALLOW_COPY_AND_ASSIGN(MemoryPressureObserverChromeOS);
101 }; 105 };
102 106
103 } // namespace base 107 } // namespace base
104 108
105 #endif // BASE_CHROMEOS_MEMORY_PRESSURE_OBSERVER_CHROMEOS_H_ 109 #endif // BASE_CHROMEOS_MEMORY_PRESSURE_OBSERVER_CHROMEOS_H_
OLDNEW
« no previous file with comments | « base/bind_unittest.nc ('k') | base/chromeos/memory_pressure_observer_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698