Chromium Code Reviews

Side by Side Diff: content/browser/memory/memory_monitor_win.h

Issue 2321313002: Move components/memory_coordinator -> content/ (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_MONITOR_WIN_H_ 5 #ifndef CONTENT_BROWSER_MEMORY_BROWSER_MEMORY_MONITOR_WIN_H_
6 #define COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_MONITOR_WIN_H_ 6 #define CONTENT_BROWSER_MEMORY_BROWSER_MEMORY_MONITOR_WIN_H_
7 7
8 #include "components/memory_coordinator/browser/memory_monitor.h" 8 #include "content/browser/memory/memory_monitor.h"
9 #include "components/memory_coordinator/common/memory_coordinator_export.h"
10 9
11 namespace base { 10 namespace base {
12 struct SystemMemoryInfoKB; 11 struct SystemMemoryInfoKB;
13 } // namespace base 12 } // namespace base
14 13
15 namespace memory_coordinator { 14 namespace content {
16 15
17 class MemoryMonitorWinDelegate; 16 class MemoryMonitorWinDelegate;
18 17
19 // A memory monitor for the Windows platform. After much experimentation this 18 // A memory monitor for the Windows platform. After much experimentation this
20 // class uses a very simple heuristic to anticipate paging (critical memory 19 // class uses a very simple heuristic to anticipate paging (critical memory
21 // pressure). When the amount of memory available dips below a provided 20 // pressure). When the amount of memory available dips below a provided
22 // threshold, it is assumed that paging is inevitable. 21 // threshold, it is assumed that paging is inevitable.
23 class MEMORY_COORDINATOR_EXPORT MemoryMonitorWin : public MemoryMonitor { 22 class CONTENT_EXPORT MemoryMonitorWin : public MemoryMonitor {
24 public: 23 public:
25 // Default constants governing the amount of free memory that the memory 24 // Default constants governing the amount of free memory that the memory
26 // manager attempts to maintain. 25 // manager attempts to maintain.
27 static const int kLargeMemoryThresholdMB; 26 static const int kLargeMemoryThresholdMB;
28 static const int kSmallMemoryTargetFreeMB; 27 static const int kSmallMemoryTargetFreeMB;
29 static const int kLargeMemoryTargetFreeMB; 28 static const int kLargeMemoryTargetFreeMB;
30 29
31 MemoryMonitorWin(MemoryMonitorWinDelegate* delegate, int target_free_mb); 30 MemoryMonitorWin(MemoryMonitorWinDelegate* delegate, int target_free_mb);
32 ~MemoryMonitorWin() override {} 31 ~MemoryMonitorWin() override {}
33 32
(...skipping 23 matching lines...)
57 MemoryMonitorWinDelegate* delegate_; 56 MemoryMonitorWinDelegate* delegate_;
58 57
59 // The amount of memory that the memory manager (MM) attempts to keep in a 58 // The amount of memory that the memory manager (MM) attempts to keep in a
60 // free state. When less than this amount of physical memory is free, it is 59 // free state. When less than this amount of physical memory is free, it is
61 // assumed that the MM will start paging things out. 60 // assumed that the MM will start paging things out.
62 int target_free_mb_; 61 int target_free_mb_;
63 }; 62 };
64 63
65 // A delegate that wraps functions used by MemoryMonitorWin. Used as a testing 64 // A delegate that wraps functions used by MemoryMonitorWin. Used as a testing
66 // seam. 65 // seam.
67 class MEMORY_COORDINATOR_EXPORT MemoryMonitorWinDelegate { 66 class CONTENT_EXPORT MemoryMonitorWinDelegate {
68 public: 67 public:
69 MemoryMonitorWinDelegate() {} 68 MemoryMonitorWinDelegate() {}
70 virtual ~MemoryMonitorWinDelegate() {} 69 virtual ~MemoryMonitorWinDelegate() {}
71 70
72 // Returns system memory information. 71 // Returns system memory information.
73 virtual void GetSystemMemoryInfo(base::SystemMemoryInfoKB* mem_info) = 0; 72 virtual void GetSystemMemoryInfo(base::SystemMemoryInfoKB* mem_info) = 0;
74 73
75 private: 74 private:
76 DISALLOW_COPY_AND_ASSIGN(MemoryMonitorWinDelegate); 75 DISALLOW_COPY_AND_ASSIGN(MemoryMonitorWinDelegate);
77 }; 76 };
78 77
79 } // namespace memory_coordinator 78 } // namespace content
80 79
81 #endif // COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_MONITOR_WIN_H_ 80 #endif // CONTENT_BROWSER_MEMORY_BROWSER_MEMORY_MONITOR_WIN_H_
OLDNEW

Powered by Google App Engine