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

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

Issue 2434103003: Add Mac memory pressure statistic reporting and consolidate platform code (Closed)
Patch Set: Add radar ID Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_MAC_H_ 5 #ifndef BASE_MEMORY_MEMORY_PRESSURE_MONITOR_MAC_H_
6 #define BASE_MEMORY_MEMORY_PRESSURE_MONITOR_MAC_H_ 6 #define BASE_MEMORY_MEMORY_PRESSURE_MONITOR_MAC_H_
7 7
8 #include <CoreFoundation/CFDate.h>
8 #include <dispatch/dispatch.h> 9 #include <dispatch/dispatch.h>
9 10
10 #include "base/base_export.h" 11 #include "base/base_export.h"
11 #include "base/mac/scoped_dispatch_object.h" 12 #include "base/mac/scoped_dispatch_object.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/memory_pressure_listener.h" 14 #include "base/memory/memory_pressure_listener.h"
14 #include "base/memory/memory_pressure_monitor.h" 15 #include "base/memory/memory_pressure_monitor.h"
15 16
16 namespace base { 17 namespace base {
17 namespace mac { 18 namespace mac {
(...skipping 10 matching lines...) Expand all
28 // Returns the currently-observed memory pressure. 29 // Returns the currently-observed memory pressure.
29 MemoryPressureLevel GetCurrentPressureLevel() const override; 30 MemoryPressureLevel GetCurrentPressureLevel() const override;
30 31
31 void SetDispatchCallback(const DispatchCallback& callback) override; 32 void SetDispatchCallback(const DispatchCallback& callback) override;
32 33
33 private: 34 private:
34 friend TestMemoryPressureMonitor; 35 friend TestMemoryPressureMonitor;
35 36
36 static MemoryPressureLevel 37 static MemoryPressureLevel
37 MemoryPressureLevelForMacMemoryPressure(int mac_memory_pressure); 38 MemoryPressureLevelForMacMemoryPressure(int mac_memory_pressure);
38 static void NotifyMemoryPressureChanged( 39 void OnMemoryPressureChanged(dispatch_source_s* event_source,
39 dispatch_source_s* event_source, 40 const DispatchCallback& dispatch_callback);
40 const DispatchCallback& dispatch_callback);
41 41
42 ScopedDispatchObject<dispatch_source_t> memory_level_event_source_; 42 ScopedDispatchObject<dispatch_source_t> memory_level_event_source_;
43 43
44 DispatchCallback dispatch_callback_; 44 DispatchCallback dispatch_callback_;
45 45
46 CFTimeInterval last_pressure_change_;
47
48 MemoryPressureLevel last_pressure_level_;
49
50 // The UMA statistic is recorded in 5 second increments. This
51 // accumulates the remaining time to be rolled into the next
52 // call.
53 CFTimeInterval reporting_error_;
54
46 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor); 55 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor);
47 }; 56 };
48 57
49 } // namespace mac 58 } // namespace mac
50 } // namespace base 59 } // namespace base
51 60
52 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_MAC_H_ 61 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_MAC_H_
OLDNEW
« no previous file with comments | « base/memory/memory_pressure_monitor_chromeos.cc ('k') | base/memory/memory_pressure_monitor_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698