Index: content/browser/memory/memory_pressure_controller.cc |
diff --git a/content/browser/memory/memory_pressure_controller.cc b/content/browser/memory/memory_pressure_controller.cc |
deleted file mode 100644 |
index 0aa72ac1109d4fc5b7fb34508b2bd693b2f4f7ff..0000000000000000000000000000000000000000 |
--- a/content/browser/memory/memory_pressure_controller.cc |
+++ /dev/null |
@@ -1,71 +0,0 @@ |
-// 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. |
- |
-#include "content/browser/memory/memory_pressure_controller.h" |
- |
-#include "base/bind.h" |
-#include "base/memory/memory_pressure_listener.h" |
-#include "content/browser/memory/memory_message_filter.h" |
-#include "content/public/browser/browser_thread.h" |
- |
-namespace content { |
- |
-MemoryPressureController::MemoryPressureController() {} |
- |
-MemoryPressureController::~MemoryPressureController() {} |
- |
-void MemoryPressureController::OnMemoryMessageFilterAdded( |
- MemoryMessageFilter* filter) { |
- DCHECK_CURRENTLY_ON(BrowserThread::IO); |
- |
- // Add the message filter to the set of all memory message filters and check |
- // that it wasn't there beforehand. |
- DCHECK(memory_message_filters_.insert(filter).second); |
- |
- // There's no need to send a message to the child process if memory pressure |
- // notifications are not suppressed. |
- if (base::MemoryPressureListener::AreNotificationsSuppressed()) |
- filter->SendSetPressureNotificationsSuppressed(true); |
-} |
- |
-void MemoryPressureController::OnMemoryMessageFilterRemoved( |
- MemoryMessageFilter* filter) { |
- DCHECK_CURRENTLY_ON(BrowserThread::IO); |
- |
- // Remove the message filter from the set of all memory message filters and |
- // check that it was there beforehand. |
- DCHECK_EQ(1u, memory_message_filters_.erase(filter)); |
-} |
- |
-// static |
-MemoryPressureController* MemoryPressureController::GetInstance() { |
- return base::Singleton< |
- MemoryPressureController, |
- base::LeakySingletonTraits<MemoryPressureController>>::get(); |
-} |
- |
-void MemoryPressureController::SetPressureNotificationsSuppressedInAllProcesses( |
- bool suppressed) { |
- if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
- // Note that passing base::Unretained(this) is safe here because the |
- // controller is a leaky singleton (i.e. it is never deleted). |
- BrowserThread::PostTask( |
- BrowserThread::IO, FROM_HERE, |
- base::Bind(&MemoryPressureController:: |
- SetPressureNotificationsSuppressedInAllProcesses, |
- base::Unretained(this), suppressed)); |
- return; |
- } |
- |
- // Enable/disable suppressing memory notifications in the browser process. |
- base::MemoryPressureListener::SetNotificationsSuppressed(suppressed); |
- |
- // Enable/disable suppressing memory notifications in all child processes. |
- for (MemoryMessageFilterSet::iterator it = memory_message_filters_.begin(); |
- it != memory_message_filters_.end(); ++it) { |
- it->get()->SendSetPressureNotificationsSuppressed(suppressed); |
- } |
-} |
- |
-} // namespace content |