| OLD | NEW |
| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 mojom::MemoryState memory_state; | 91 mojom::MemoryState memory_state; |
| 92 std::unique_ptr<MemoryCoordinatorHandleImpl> handle; | 92 std::unique_ptr<MemoryCoordinatorHandleImpl> handle; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 // A map from process ID (RenderProcessHost::GetID()) to child process info. | 95 // A map from process ID (RenderProcessHost::GetID()) to child process info. |
| 96 using ChildInfoMap = std::map<int, ChildInfo>; | 96 using ChildInfoMap = std::map<int, ChildInfo>; |
| 97 | 97 |
| 98 ChildInfoMap& children() { return children_; } | 98 ChildInfoMap& children() { return children_; } |
| 99 | 99 |
| 100 private: | 100 MemoryCoordinatorDelegate* delegate() { return delegate_.get(); } |
| 101 |
| 102 private: |
| 101 // Helper function of CreateHandle and AddChildForTesting. | 103 // Helper function of CreateHandle and AddChildForTesting. |
| 102 void CreateChildInfoMapEntry( | 104 void CreateChildInfoMapEntry( |
| 103 int render_process_id, | 105 int render_process_id, |
| 104 std::unique_ptr<MemoryCoordinatorHandleImpl> handle); | 106 std::unique_ptr<MemoryCoordinatorHandleImpl> handle); |
| 105 | 107 |
| 106 // Tracks child processes. An entry is added when a renderer connects to | 108 // Tracks child processes. An entry is added when a renderer connects to |
| 107 // MemoryCoordinator and removed automatically when an underlying binding is | 109 // MemoryCoordinator and removed automatically when an underlying binding is |
| 108 // disconnected. | 110 // disconnected. |
| 109 ChildInfoMap children_; | 111 ChildInfoMap children_; |
| 110 | 112 |
| 111 std::unique_ptr<MemoryCoordinatorDelegate> delegate_; | 113 std::unique_ptr<MemoryCoordinatorDelegate> delegate_; |
| 112 | 114 |
| 113 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); | 115 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); |
| 114 }; | 116 }; |
| 115 | 117 |
| 116 } // namespace content | 118 } // namespace content |
| 117 | 119 |
| 118 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ | 120 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ |
| OLD | NEW |