| 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 |
| 123 base::MemoryState MemoryCoordinator::GetCurrentMemoryState() const { | 131 base::MemoryState MemoryCoordinator::GetCurrentMemoryState() const { |
| 124 return base::MemoryState::UNKNOWN; | 132 return base::MemoryState::UNKNOWN; |
| 125 } | 133 } |
| 126 | 134 |
| 127 void MemoryCoordinator::AddChildForTesting( | 135 void MemoryCoordinator::AddChildForTesting( |
| 128 int dummy_render_process_id, mojom::ChildMemoryCoordinatorPtr child) { | 136 int dummy_render_process_id, mojom::ChildMemoryCoordinatorPtr child) { |
| 129 mojom::MemoryCoordinatorHandlePtr mch; | 137 mojom::MemoryCoordinatorHandlePtr mch; |
| 130 auto request = mojo::GetProxy(&mch); | 138 auto request = mojo::GetProxy(&mch); |
| 131 std::unique_ptr<MemoryCoordinatorHandleImpl> handle( | 139 std::unique_ptr<MemoryCoordinatorHandleImpl> handle( |
| 132 new MemoryCoordinatorHandleImpl(std::move(request), this, | 140 new MemoryCoordinatorHandleImpl(std::move(request), this, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 180 |
| 173 MemoryCoordinator::ChildInfo::ChildInfo() {} | 181 MemoryCoordinator::ChildInfo::ChildInfo() {} |
| 174 | 182 |
| 175 MemoryCoordinator::ChildInfo::ChildInfo(const ChildInfo& rhs) { | 183 MemoryCoordinator::ChildInfo::ChildInfo(const ChildInfo& rhs) { |
| 176 // This is a nop, but exists for compatibility with STL containers. | 184 // This is a nop, but exists for compatibility with STL containers. |
| 177 } | 185 } |
| 178 | 186 |
| 179 MemoryCoordinator::ChildInfo::~ChildInfo() {} | 187 MemoryCoordinator::ChildInfo::~ChildInfo() {} |
| 180 | 188 |
| 181 } // namespace content | 189 } // namespace content |
| OLD | NEW |