| 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 void MemoryCoordinator::EnableFeaturesForTesting() { | |
| 124 base::FeatureList::ClearInstanceForTesting(); | |
| 125 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); | |
| 126 feature_list->InitializeFromCommandLine(features::kMemoryCoordinator.name, | |
| 127 ""); | |
| 128 base::FeatureList::SetInstance(std::move(feature_list)); | |
| 129 } | |
| 130 | |
| 131 base::MemoryState MemoryCoordinator::GetCurrentMemoryState() const { | 123 base::MemoryState MemoryCoordinator::GetCurrentMemoryState() const { |
| 132 return base::MemoryState::UNKNOWN; | 124 return base::MemoryState::UNKNOWN; |
| 133 } | 125 } |
| 134 | 126 |
| 135 void MemoryCoordinator::SetCurrentMemoryStateForTesting( | 127 void MemoryCoordinator::SetCurrentMemoryStateForTesting( |
| 136 base::MemoryState memory_state) { | 128 base::MemoryState memory_state) { |
| 137 } | 129 } |
| 138 | 130 |
| 139 void MemoryCoordinator::AddChildForTesting( | 131 void MemoryCoordinator::AddChildForTesting( |
| 140 int dummy_render_process_id, mojom::ChildMemoryCoordinatorPtr child) { | 132 int dummy_render_process_id, mojom::ChildMemoryCoordinatorPtr child) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 176 |
| 185 MemoryCoordinator::ChildInfo::ChildInfo() {} | 177 MemoryCoordinator::ChildInfo::ChildInfo() {} |
| 186 | 178 |
| 187 MemoryCoordinator::ChildInfo::ChildInfo(const ChildInfo& rhs) { | 179 MemoryCoordinator::ChildInfo::ChildInfo(const ChildInfo& rhs) { |
| 188 // This is a nop, but exists for compatibility with STL containers. | 180 // This is a nop, but exists for compatibility with STL containers. |
| 189 } | 181 } |
| 190 | 182 |
| 191 MemoryCoordinator::ChildInfo::~ChildInfo() {} | 183 MemoryCoordinator::ChildInfo::~ChildInfo() {} |
| 192 | 184 |
| 193 } // namespace content | 185 } // namespace content |
| OLD | NEW |