| 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 "content/public/browser/content_browser_client.h" | 8 #include "content/public/browser/content_browser_client.h" |
| 9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
| 10 #include "content/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 113 } |
| 114 | 114 |
| 115 mojom::MemoryState MemoryCoordinator::GetMemoryState( | 115 mojom::MemoryState MemoryCoordinator::GetMemoryState( |
| 116 int render_process_id) const { | 116 int render_process_id) const { |
| 117 auto iter = children_.find(render_process_id); | 117 auto iter = children_.find(render_process_id); |
| 118 if (iter == children_.end()) | 118 if (iter == children_.end()) |
| 119 return mojom::MemoryState::UNKNOWN; | 119 return mojom::MemoryState::UNKNOWN; |
| 120 return iter->second.memory_state; | 120 return iter->second.memory_state; |
| 121 } | 121 } |
| 122 | 122 |
| 123 base::MemoryState MemoryCoordinator::GetCurrentMemoryState() const { |
| 124 return base::MemoryState::UNKNOWN; |
| 125 } |
| 126 |
| 123 void MemoryCoordinator::AddChildForTesting( | 127 void MemoryCoordinator::AddChildForTesting( |
| 124 int dummy_render_process_id, mojom::ChildMemoryCoordinatorPtr child) { | 128 int dummy_render_process_id, mojom::ChildMemoryCoordinatorPtr child) { |
| 125 mojom::MemoryCoordinatorHandlePtr mch; | 129 mojom::MemoryCoordinatorHandlePtr mch; |
| 126 auto request = mojo::GetProxy(&mch); | 130 auto request = mojo::GetProxy(&mch); |
| 127 std::unique_ptr<MemoryCoordinatorHandleImpl> handle( | 131 std::unique_ptr<MemoryCoordinatorHandleImpl> handle( |
| 128 new MemoryCoordinatorHandleImpl(std::move(request), this, | 132 new MemoryCoordinatorHandleImpl(std::move(request), this, |
| 129 dummy_render_process_id)); | 133 dummy_render_process_id)); |
| 130 handle->AddChild(std::move(child)); | 134 handle->AddChild(std::move(child)); |
| 131 CreateChildInfoMapEntry(dummy_render_process_id, std::move(handle)); | 135 CreateChildInfoMapEntry(dummy_render_process_id, std::move(handle)); |
| 132 } | 136 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 172 |
| 169 MemoryCoordinator::ChildInfo::ChildInfo() {} | 173 MemoryCoordinator::ChildInfo::ChildInfo() {} |
| 170 | 174 |
| 171 MemoryCoordinator::ChildInfo::ChildInfo(const ChildInfo& rhs) { | 175 MemoryCoordinator::ChildInfo::ChildInfo(const ChildInfo& rhs) { |
| 172 // This is a nop, but exists for compatibility with STL containers. | 176 // This is a nop, but exists for compatibility with STL containers. |
| 173 } | 177 } |
| 174 | 178 |
| 175 MemoryCoordinator::ChildInfo::~ChildInfo() {} | 179 MemoryCoordinator::ChildInfo::~ChildInfo() {} |
| 176 | 180 |
| 177 } // namespace content | 181 } // namespace content |
| OLD | NEW |