| Index: content/browser/memory/memory_coordinator_impl.cc
|
| diff --git a/content/browser/memory/memory_coordinator_impl.cc b/content/browser/memory/memory_coordinator_impl.cc
|
| index 0ed6859c49a819d8a97f8dcd63450f82a72bcb38..ec2bc2048031624902e40416d40ca4b2b991ea49 100644
|
| --- a/content/browser/memory/memory_coordinator_impl.cc
|
| +++ b/content/browser/memory/memory_coordinator_impl.cc
|
| @@ -154,6 +154,11 @@ struct MemoryCoordinatorImplSingletonTraits
|
| };
|
|
|
| // static
|
| +MemoryCoordinator* MemoryCoordinator::GetInstance() {
|
| + return MemoryCoordinatorImpl::GetInstance();
|
| +}
|
| +
|
| +// static
|
| MemoryCoordinatorImpl* MemoryCoordinatorImpl::GetInstance() {
|
| if (!base::FeatureList::IsEnabled(features::kMemoryCoordinator))
|
| return nullptr;
|
| @@ -297,6 +302,22 @@ void MemoryCoordinatorImpl::Observe(int type,
|
| SetChildMemoryState(iter->first, new_state);
|
| }
|
|
|
| +base::MemoryState MemoryCoordinatorImpl::GetStateForProcess(
|
| + base::ProcessHandle handle) {
|
| + DCHECK(CalledOnValidThread());
|
| + if (handle == base::kNullProcessHandle)
|
| + return MemoryState::UNKNOWN;
|
| + if (handle == base::GetCurrentProcessHandle())
|
| + return GetCurrentMemoryState();
|
| +
|
| + for (auto& iter : children()) {
|
| + auto* render_process_host = GetRenderProcessHost(iter.first);
|
| + if (render_process_host && render_process_host->GetHandle() == handle)
|
| + return iter.second.memory_state;
|
| + }
|
| + return MemoryState::UNKNOWN;
|
| +}
|
| +
|
| bool MemoryCoordinatorImpl::ChangeStateIfNeeded(base::MemoryState prev_state,
|
| base::MemoryState next_state) {
|
| DCHECK(CalledOnValidThread());
|
|
|