Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(742)

Unified Diff: content/browser/memory/memory_message_filter.cc

Issue 1332583002: Architecture for cross-process memory notification suppressing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split patch Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/memory/memory_message_filter.cc
diff --git a/content/browser/memory/memory_message_filter.cc b/content/browser/memory/memory_message_filter.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4bee936c91365587e78fa28be679896e29285256
--- /dev/null
+++ b/content/browser/memory/memory_message_filter.cc
@@ -0,0 +1,47 @@
+// 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_message_filter.h"
+
+#include "content/browser/memory/memory_pressure_controller.h"
+#include "content/common/memory_messages.h"
+
+namespace content {
+namespace memory {
+
+MemoryMessageFilter::MemoryMessageFilter()
+ : BrowserMessageFilter(MemoryMsgStart) {}
+
+MemoryMessageFilter::~MemoryMessageFilter() {}
+
+void MemoryMessageFilter::OnFilterAdded(IPC::Sender* sender) {
+ MemoryPressureController::GetInstance()->OnMemoryMessageFilterAdded(this);
+}
+
+void MemoryMessageFilter::OnFilterRemoved() {
+ MemoryPressureController::GetInstance()->OnMemoryMessageFilterRemoved(this);
+}
+
+bool MemoryMessageFilter::OnMessageReceived(const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(MemoryMessageFilter, message)
+ IPC_MESSAGE_HANDLER(MemoryHostMsg_SetPressureNotificationsSuppressedAck,
+ OnSetPressureNotificationsSuppressedAck)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
+void MemoryMessageFilter::SendSetPressureNotificationsSuppressed(
+ bool suppressed) {
+ Send(new MemoryMsg_SetPressureNotificationsSuppressed(suppressed));
+}
+
+void MemoryMessageFilter::OnSetPressureNotificationsSuppressedAck() {
Primiano Tucci (use gerrit) 2015/09/16 09:11:49 This is probably unneeded (See my comment on the t
petrcermak 2015/09/16 18:14:25 As discussed offline, we will drop acks for the ti
+ MemoryPressureController::GetInstance()
+ ->OnSetPressureNotificationsSuppressedResponse(this);
+}
+
+} // namespace memory
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698