| Index: content/browser/memory/memory_monitor_mac.h
|
| diff --git a/content/browser/memory/memory_monitor_mac.h b/content/browser/memory/memory_monitor_mac.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fe79fac473955b55b84ebccfb8acdf4dad35d770
|
| --- /dev/null
|
| +++ b/content/browser/memory/memory_monitor_mac.h
|
| @@ -0,0 +1,47 @@
|
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_BROWSER_MEMORY_MEMORY_MONITOR_MAC_H_
|
| +#define CONTENT_BROWSER_MEMORY_MEMORY_MONITOR_MAC_H_
|
| +
|
| +#include "content/browser/memory/memory_monitor.h"
|
| +#include "content/common/content_export.h"
|
| +
|
| +namespace content {
|
| +
|
| +// A memory monitor for the Mac platform.
|
| +class CONTENT_EXPORT MemoryMonitorMac : public MemoryMonitor {
|
| + public:
|
| + MemoryMonitorMac(MemoryMonitorDelegate* delegate);
|
| + ~MemoryMonitorMac() override;
|
| +
|
| + // MemoryMonitor:
|
| + int GetFreeMemoryUntilCriticalMB() override;
|
| +
|
| + // Factory function to create an instance of this class.
|
| + static std::unique_ptr<MemoryMonitorMac> Create(
|
| + MemoryMonitorDelegate* delegate);
|
| +
|
| + private:
|
| + // The delegate to be used for retrieving system memory information. Used as a
|
| + // testing seam.
|
| + MemoryMonitorDelegate* delegate_;
|
| +
|
| + // The threshold of free memory that is considered "critical". This value is
|
| + // determined dynamically via system "memory pressure" events.
|
| + int critical_free_mb_;
|
| +};
|
| +
|
| +// An delegate with extra methods required to support Mac.
|
| +class CONTENT_EXPORT MemoryMonitorMacDelegate : public MemoryMonitorDelegate {
|
| + public:
|
| + static MemoryMonitorMacDelegate* GetInstance();
|
| +
|
| + // Returns system memory-pressure information.
|
| + bool GetSystemMemoryPressure(int* mem_pressure) override;
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_MEMORY_MEMORY_MONITOR_MAC_H_
|
|
|