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

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

Issue 2882513004: Remove renderer notifications of memory pressure. (Closed)
Patch Set: Merge Created 3 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_MEMORY_MEMORY_MESSAGE_FILTER_H_
6 #define CONTENT_BROWSER_MEMORY_MEMORY_MESSAGE_FILTER_H_
7
8 #include "base/macros.h"
9 #include "base/memory/memory_pressure_listener.h"
10 #include "content/common/content_export.h"
11 #include "content/public/browser/browser_message_filter.h"
12 #include "content/public/common/process_type.h"
13
14 namespace content {
15
16 class BrowserChildProcessHost;
17 class RenderProcessHost;
18
19 // This class sends memory messages from the browser process.
20 // See also: child_memory_message_filter.h
21 class CONTENT_EXPORT MemoryMessageFilter : public BrowserMessageFilter {
22 public:
23 MemoryMessageFilter(const BrowserChildProcessHost* child_process_host,
24 ProcessType process_type);
25 MemoryMessageFilter(const RenderProcessHost* render_process_host);
26
27 // BrowserMessageFilter implementation.
28 void OnFilterAdded(IPC::Channel* channel) override;
29 void OnChannelClosing() override;
30 bool OnMessageReceived(const IPC::Message& message) override;
31
32 void SendSetPressureNotificationsSuppressed(bool suppressed);
33 void SendSimulatePressureNotification(
34 base::MemoryPressureListener::MemoryPressureLevel level);
35 void SendPressureNotification(
36 base::MemoryPressureListener::MemoryPressureLevel level);
37
38 protected:
39 friend class MemoryPressureControllerImpl;
40
41 ~MemoryMessageFilter() override;
42
43 const void* process_host() const { return process_host_; }
44 ProcessType process_type() const { return process_type_; }
45
46 private:
47 // The untyped process host and ProcessType associated with this filter
48 // instance. The process host is stored as untyped because it is only used as
49 // a key in MemoryPressureControllerImpl; at no point is it ever deferenced to
50 // invoke any members on a process host.
51 const void* process_host_;
52 ProcessType process_type_;
53
54 DISALLOW_COPY_AND_ASSIGN(MemoryMessageFilter);
55 };
56
57 } // namespace content
58
59 #endif // CONTENT_BROWSER_MEMORY_MEMORY_MESSAGE_FILTER_H_
OLDNEW
« no previous file with comments | « content/browser/devtools/protocol/memory_handler.cc ('k') | content/browser/memory/memory_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698