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

Side by Side Diff: content/browser/memory/memory_message_filter.cc

Issue 1641813002: Provide renderers with memory pressure signals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@contentapi
Patch Set: Addressed creis' comments. Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/memory/memory_message_filter.h" 5 #include "content/browser/memory/memory_message_filter.h"
6 6
7 #include "content/browser/memory/memory_pressure_controller.h" 7 #include "content/browser/memory/memory_pressure_controller_impl.h"
8 #include "content/common/memory_messages.h" 8 #include "content/common/memory_messages.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 MemoryMessageFilter::MemoryMessageFilter( 12 MemoryMessageFilter::MemoryMessageFilter(
13 const BrowserChildProcessHost* child_process_host, 13 const BrowserChildProcessHost* child_process_host,
14 ProcessType process_type) 14 ProcessType process_type)
15 : BrowserMessageFilter(MemoryMsgStart), 15 : BrowserMessageFilter(MemoryMsgStart),
16 process_host_(child_process_host), 16 process_host_(child_process_host),
17 process_type_(process_type) { 17 process_type_(process_type) {
18 DCHECK_NE(process_type_, PROCESS_TYPE_RENDERER); 18 DCHECK_NE(process_type_, PROCESS_TYPE_RENDERER);
19 } 19 }
20 20
21 MemoryMessageFilter::MemoryMessageFilter( 21 MemoryMessageFilter::MemoryMessageFilter(
22 const RenderProcessHost* render_process_host) 22 const RenderProcessHost* render_process_host)
23 : BrowserMessageFilter(MemoryMsgStart), 23 : BrowserMessageFilter(MemoryMsgStart),
24 process_host_(render_process_host), 24 process_host_(render_process_host),
25 process_type_(PROCESS_TYPE_RENDERER) {} 25 process_type_(PROCESS_TYPE_RENDERER) {}
26 26
27 MemoryMessageFilter::~MemoryMessageFilter() {} 27 MemoryMessageFilter::~MemoryMessageFilter() {}
28 28
29 void MemoryMessageFilter::OnFilterAdded(IPC::Sender* sender) { 29 void MemoryMessageFilter::OnFilterAdded(IPC::Sender* sender) {
30 MemoryPressureController::GetInstance()->OnMemoryMessageFilterAdded(this); 30 MemoryPressureControllerImpl::GetInstance()->OnMemoryMessageFilterAdded(this);
31 } 31 }
32 32
33 void MemoryMessageFilter::OnChannelClosing() { 33 void MemoryMessageFilter::OnChannelClosing() {
34 MemoryPressureController::GetInstance()->OnMemoryMessageFilterRemoved(this); 34 MemoryPressureControllerImpl::GetInstance()
35 ->OnMemoryMessageFilterRemoved(this);
35 } 36 }
36 37
37 bool MemoryMessageFilter::OnMessageReceived(const IPC::Message& message) { 38 bool MemoryMessageFilter::OnMessageReceived(const IPC::Message& message) {
38 return false; 39 return false;
39 } 40 }
40 41
41 void MemoryMessageFilter::SendSetPressureNotificationsSuppressed( 42 void MemoryMessageFilter::SendSetPressureNotificationsSuppressed(
42 bool suppressed) { 43 bool suppressed) {
43 Send(new MemoryMsg_SetPressureNotificationsSuppressed(suppressed)); 44 Send(new MemoryMsg_SetPressureNotificationsSuppressed(suppressed));
44 } 45 }
45 46
46 void MemoryMessageFilter::SendSimulatePressureNotification( 47 void MemoryMessageFilter::SendSimulatePressureNotification(
47 base::MemoryPressureListener::MemoryPressureLevel level) { 48 base::MemoryPressureListener::MemoryPressureLevel level) {
48 Send(new MemoryMsg_SimulatePressureNotification(level)); 49 Send(new MemoryMsg_SimulatePressureNotification(level));
49 } 50 }
50 51
51 void MemoryMessageFilter::SendPressureNotification( 52 void MemoryMessageFilter::SendPressureNotification(
52 base::MemoryPressureListener::MemoryPressureLevel level) { 53 base::MemoryPressureListener::MemoryPressureLevel level) {
53 Send(new MemoryMsg_PressureNotification(level)); 54 Send(new MemoryMsg_PressureNotification(level));
54 } 55 }
55 56
56 } // namespace content 57 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/memory/memory_message_filter.h ('k') | content/browser/memory/memory_pressure_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698