| Index: content/browser/memory/memory_coordinator.cc
|
| diff --git a/content/browser/memory/memory_coordinator.cc b/content/browser/memory/memory_coordinator.cc
|
| index 52ee2ece71f8a47def79edd5401bd9c791680b49..098efddc4264d9f36c0f586622628293c3d066a1 100644
|
| --- a/content/browser/memory/memory_coordinator.cc
|
| +++ b/content/browser/memory/memory_coordinator.cc
|
| @@ -34,11 +34,19 @@ class MemoryCoordinatorHandleImpl : public mojom::MemoryCoordinatorHandle {
|
| };
|
|
|
| // static
|
| +bool MemoryCoordinator::IsEnabled() {
|
| + // TODO(tasak): Remove |kPurgeAndSuspend| when the experiment is done.
|
| + return base::FeatureList::IsEnabled(features::kMemoryCoordinator) ||
|
| + base::FeatureList::IsEnabled(features::kPurgeAndSuspend);
|
| +}
|
| +
|
| +// static
|
| MemoryCoordinator* MemoryCoordinator::GetInstance() {
|
| - if (!base::FeatureList::IsEnabled(features::kMemoryCoordinator))
|
| - return nullptr;
|
| - return base::Singleton<MemoryCoordinator,
|
| - base::LeakySingletonTraits<MemoryCoordinator>>::get();
|
| + if (IsEnabled()) {
|
| + return base::Singleton<MemoryCoordinator, base::LeakySingletonTraits<
|
| + MemoryCoordinator>>::get();
|
| + }
|
| + return nullptr;
|
| }
|
|
|
| MemoryCoordinator::MemoryCoordinator() {}
|
| @@ -89,6 +97,11 @@ mojom::MemoryState MemoryCoordinator::GetMemoryState(
|
| return iter->second.memory_state;
|
| }
|
|
|
| +bool MemoryCoordinator::PurgeAndSuspendChild(int render_process_id) {
|
| + DCHECK(base::FeatureList::IsEnabled(features::kPurgeAndSuspend));
|
| + return SetMemoryState(render_process_id, mojom::MemoryState::SUSPENDED);
|
| +}
|
| +
|
| void MemoryCoordinator::AddChildForTesting(
|
| int dummy_render_process_id, mojom::ChildMemoryCoordinatorPtr child) {
|
| mojom::MemoryCoordinatorHandlePtr mch;
|
|
|