| Index: content/browser/memory/memory_pressure_controller.h
|
| diff --git a/content/browser/memory/memory_pressure_controller.h b/content/browser/memory/memory_pressure_controller.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4350763397eb88460d9dc7e42651f0ff73cfa375
|
| --- /dev/null
|
| +++ b/content/browser/memory/memory_pressure_controller.h
|
| @@ -0,0 +1,53 @@
|
| +// Copyright 2015 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_PRESSURE_CONTROLLER_H_
|
| +#define CONTENT_BROWSER_MEMORY_MEMORY_PRESSURE_CONTROLLER_H_
|
| +
|
| +#include <set>
|
| +
|
| +#include "base/callback.h"
|
| +
|
| +namespace content {
|
| +namespace memory {
|
| +
|
| +class MemoryMessageFilter;
|
| +
|
| +using MemoryMessageCallback = base::Callback<void(bool success)>;
|
| +
|
| +class MemoryPressureController {
|
| + public:
|
| + MemoryPressureController();
|
| +
|
| + void OnMemoryMessageFilterAdded(MemoryMessageFilter* filter);
|
| + void OnMemoryMessageFilterRemoved(MemoryMessageFilter* filter);
|
| +
|
| + void SetPressureNotificationsSuppressedInAllProcesses(
|
| + bool suppressed,
|
| + const MemoryMessageCallback& callback);
|
| + void OnSetPressureNotificationsSuppressedResponse(
|
| + MemoryMessageFilter* filter);
|
| +
|
| + static MemoryPressureController* GetInstance();
|
| +
|
| + protected:
|
| + virtual ~MemoryPressureController();
|
| +
|
| + private:
|
| + // Set of all memory message filters in the browser process. Always accessed
|
| + // on the UI thread.
|
| + typedef std::set<scoped_refptr<MemoryMessageFilter>> MemoryMessageFilterSet;
|
| + MemoryMessageFilterSet memory_message_filters_;
|
| +
|
| + // Pending acks for SetPressureNotificationsSuppressedInAllProcesses.
|
| + MemoryMessageFilterSet pending_set_pressure_notifications_suppressed_filters_;
|
| + MemoryMessageCallback pending_set_pressure_notifications_suppressed_callback_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(MemoryPressureController);
|
| +};
|
| +
|
| +} // namespace memory
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_MEMORY_MEMORY_PRESSURE_CONTROLLER_H_
|
|
|