| 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 #include "content/browser/memory/memory_coordinator.h" | 5 #include "content/browser/memory/memory_coordinator.h" |
| 6 | 6 |
| 7 #include "base/memory/memory_coordinator_client_registry.h" | 7 #include "base/memory/memory_coordinator_client_registry.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "content/public/browser/content_browser_client.h" | 9 #include "content/public/browser/content_browser_client.h" |
| 10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 if (!render_process_host || !render_process_host->IsProcessBackgrounded()) | 180 if (!render_process_host || !render_process_host->IsProcessBackgrounded()) |
| 181 return false; | 181 return false; |
| 182 return delegate_->CanSuspendBackgroundedRenderer(render_process_id); | 182 return delegate_->CanSuspendBackgroundedRenderer(render_process_id); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void MemoryCoordinator::CreateChildInfoMapEntry( | 185 void MemoryCoordinator::CreateChildInfoMapEntry( |
| 186 int render_process_id, | 186 int render_process_id, |
| 187 std::unique_ptr<MemoryCoordinatorHandleImpl> handle) { | 187 std::unique_ptr<MemoryCoordinatorHandleImpl> handle) { |
| 188 auto& child_info = children_[render_process_id]; | 188 auto& child_info = children_[render_process_id]; |
| 189 // Process always start with normal memory state. | 189 // Process always start with normal memory state. |
| 190 // TODO(chrisha): Consider having memory state be a startup parameter of | 190 // We'll set renderer's memory state to the current global state when the |
| 191 // child processes, allowing them to be launched in a restricted state. | 191 // corresponding renderer process is ready to communicate. Renderer processes |
| 192 // call AddChild() when they are ready. |
| 192 child_info.memory_state = mojom::MemoryState::NORMAL; | 193 child_info.memory_state = mojom::MemoryState::NORMAL; |
| 193 child_info.handle = std::move(handle); | 194 child_info.handle = std::move(handle); |
| 194 } | 195 } |
| 195 | 196 |
| 196 MemoryCoordinator::ChildInfo::ChildInfo() {} | 197 MemoryCoordinator::ChildInfo::ChildInfo() {} |
| 197 | 198 |
| 198 MemoryCoordinator::ChildInfo::ChildInfo(const ChildInfo& rhs) { | 199 MemoryCoordinator::ChildInfo::ChildInfo(const ChildInfo& rhs) { |
| 199 // This is a nop, but exists for compatibility with STL containers. | 200 // This is a nop, but exists for compatibility with STL containers. |
| 200 } | 201 } |
| 201 | 202 |
| 202 MemoryCoordinator::ChildInfo::~ChildInfo() {} | 203 MemoryCoordinator::ChildInfo::~ChildInfo() {} |
| 203 | 204 |
| 204 } // namespace content | 205 } // namespace content |
| OLD | NEW |