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

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

Issue 2553553002: memory coordinator: Throttle foreground renderers on SUSPENDED state (Closed)
Patch Set: Fix unittests Created 4 years 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
« no previous file with comments | « no previous file | content/browser/memory/memory_coordinator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ 5 #ifndef CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_
6 #define CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ 6 #define CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_
7 7
8 #include "base/memory/memory_coordinator_client_registry.h" 8 #include "base/memory/memory_coordinator_client_registry.h"
9 #include "base/memory/memory_pressure_monitor.h" 9 #include "base/memory/memory_pressure_monitor.h"
10 #include "base/process/process_handle.h" 10 #include "base/process/process_handle.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 MemoryCoordinator(); 73 MemoryCoordinator();
74 74
75 // Adds the given ChildMemoryCoordinator as a child of this coordinator. 75 // Adds the given ChildMemoryCoordinator as a child of this coordinator.
76 void AddChildForTesting(int dummy_render_process_id, 76 void AddChildForTesting(int dummy_render_process_id,
77 mojom::ChildMemoryCoordinatorPtr child); 77 mojom::ChildMemoryCoordinatorPtr child);
78 78
79 // Callback invoked by mojo when the child connection goes down. Exposed 79 // Callback invoked by mojo when the child connection goes down. Exposed
80 // for testing. 80 // for testing.
81 void OnConnectionError(int render_process_id); 81 void OnConnectionError(int render_process_id);
82 82
83 // Returns true when a given renderer can be throttled.
84 bool CanThrottleRenderer(int render_process_id);
85
86 // Returns true when a given renderer can be suspended. 83 // Returns true when a given renderer can be suspended.
87 bool CanSuspendRenderer(int render_process_id); 84 bool CanSuspendRenderer(int render_process_id);
88 85
89 // Stores information about any known child processes. 86 // Stores information about any known child processes.
90 struct ChildInfo { 87 struct ChildInfo {
91 // This object must be compatible with STL containers. 88 // This object must be compatible with STL containers.
92 ChildInfo(); 89 ChildInfo();
93 ChildInfo(const ChildInfo& rhs); 90 ChildInfo(const ChildInfo& rhs);
94 ~ChildInfo(); 91 ~ChildInfo();
95 92
96 mojom::MemoryState memory_state; 93 mojom::MemoryState memory_state;
94 bool is_visible = false;
97 std::unique_ptr<MemoryCoordinatorHandleImpl> handle; 95 std::unique_ptr<MemoryCoordinatorHandleImpl> handle;
98 }; 96 };
99 97
100 // A map from process ID (RenderProcessHost::GetID()) to child process info. 98 // A map from process ID (RenderProcessHost::GetID()) to child process info.
101 using ChildInfoMap = std::map<int, ChildInfo>; 99 using ChildInfoMap = std::map<int, ChildInfo>;
102 100
103 ChildInfoMap& children() { return children_; } 101 ChildInfoMap& children() { return children_; }
104 102
105 private: 103 private:
106 #if !defined(OS_MACOSX) 104 #if !defined(OS_MACOSX)
(...skipping 18 matching lines...) Expand all
125 ChildInfoMap children_; 123 ChildInfoMap children_;
126 124
127 std::unique_ptr<MemoryCoordinatorDelegate> delegate_; 125 std::unique_ptr<MemoryCoordinatorDelegate> delegate_;
128 126
129 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); 127 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator);
130 }; 128 };
131 129
132 } // namespace content 130 } // namespace content
133 131
134 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ 132 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/memory/memory_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698