| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_MEMORY_MEMORY_MONITOR_MAC_H_ |
| 6 #define CONTENT_BROWSER_MEMORY_MEMORY_MONITOR_MAC_H_ |
| 7 |
| 8 #include "content/browser/memory/memory_monitor.h" |
| 9 #include "content/common/content_export.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 // A memory monitor for the Mac platform. |
| 14 class CONTENT_EXPORT MemoryMonitorMac : public MemoryMonitor { |
| 15 public: |
| 16 MemoryMonitorMac(MemoryMonitorDelegate* delegate); |
| 17 ~MemoryMonitorMac() override; |
| 18 |
| 19 // MemoryMonitor: |
| 20 int GetFreeMemoryUntilCriticalMB() override; |
| 21 |
| 22 // Factory function to create an instance of this class. |
| 23 static std::unique_ptr<MemoryMonitorMac> Create( |
| 24 MemoryMonitorDelegate* delegate); |
| 25 |
| 26 private: |
| 27 // The delegate to be used for retrieving system memory information. Used as a |
| 28 // testing seam. |
| 29 MemoryMonitorDelegate* delegate_; |
| 30 |
| 31 // The threshold of free memory that is considered "critical". This value is |
| 32 // determined dynamically via system "memory pressure" events. |
| 33 int critical_free_mb_; |
| 34 }; |
| 35 |
| 36 // An delegate with extra methods required to support Mac. |
| 37 class CONTENT_EXPORT MemoryMonitorMacDelegate : public MemoryMonitorDelegate { |
| 38 public: |
| 39 static MemoryMonitorMacDelegate* GetInstance(); |
| 40 |
| 41 // Returns system memory-pressure information. |
| 42 bool GetSystemMemoryPressure(int* mem_pressure) override; |
| 43 }; |
| 44 |
| 45 } // namespace content |
| 46 |
| 47 #endif // CONTENT_BROWSER_MEMORY_MEMORY_MONITOR_MAC_H_ |
| OLD | NEW |