OLD | NEW |
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 #include "components/memory_coordinator/browser/memory_monitor_win.h" | 5 #include "content/browser/memory/memory_monitor_win.h" |
6 | 6 |
7 #include "base/process/process_metrics.h" | 7 #include "base/process/process_metrics.h" |
8 | 8 |
9 // TODO(chrisha): Implement a mechanism for observing swapping, and updating the | 9 // TODO(chrisha): Implement a mechanism for observing swapping, and updating the |
10 // memory threshold on a per machine basis. | 10 // memory threshold on a per machine basis. |
11 | 11 |
12 namespace memory_coordinator { | 12 namespace content { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 const int kKBperMB = 1024; | 16 const int kKBperMB = 1024; |
17 | 17 |
18 // A default implementation of MemoryMonitorWinDelegate. Used by default by | 18 // A default implementation of MemoryMonitorWinDelegate. Used by default by |
19 // MemoryMonitorWin. | 19 // MemoryMonitorWin. |
20 class MemoryMonitorWinDelegateImpl : public MemoryMonitorWinDelegate { | 20 class MemoryMonitorWinDelegateImpl : public MemoryMonitorWinDelegate { |
21 public: | 21 public: |
22 MemoryMonitorWinDelegateImpl() {} | 22 MemoryMonitorWinDelegateImpl() {} |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 if (IsLargeMemory(delegate)) | 86 if (IsLargeMemory(delegate)) |
87 return MemoryMonitorWin::kLargeMemoryTargetFreeMB; | 87 return MemoryMonitorWin::kLargeMemoryTargetFreeMB; |
88 return MemoryMonitorWin::kSmallMemoryTargetFreeMB; | 88 return MemoryMonitorWin::kSmallMemoryTargetFreeMB; |
89 } | 89 } |
90 | 90 |
91 // Implementation of factory function defined in memory_monitor.h. | 91 // Implementation of factory function defined in memory_monitor.h. |
92 std::unique_ptr<MemoryMonitor> CreateMemoryMonitor() { | 92 std::unique_ptr<MemoryMonitor> CreateMemoryMonitor() { |
93 return MemoryMonitorWin::Create(&g_memory_monitor_win_delegate); | 93 return MemoryMonitorWin::Create(&g_memory_monitor_win_delegate); |
94 } | 94 } |
95 | 95 |
96 } // namespace memory_coordinator | 96 } // namespace content |
OLD | NEW |