| Index: chrome/browser/memory/tab_manager.cc
|
| diff --git a/chrome/browser/memory/tab_manager.cc b/chrome/browser/memory/tab_manager.cc
|
| index 6fa39ad66f4abcae4e9a2b8fd9c2677945db888f..05c1825ee3f7523998eed4ee608bd1c38e651215 100644
|
| --- a/chrome/browser/memory/tab_manager.cc
|
| +++ b/chrome/browser/memory/tab_manager.cc
|
| @@ -45,6 +45,7 @@
|
| #include "chrome/common/chrome_features.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/url_constants.h"
|
| +#include "components/memory_coordinator/browser/memory_coordinator.h"
|
| #include "components/metrics/system_memory_stats_recorder.h"
|
| #include "components/variations/variations_associated_data.h"
|
| #include "content/public/browser/browser_thread.h"
|
| @@ -132,6 +133,14 @@ void NotifyRendererProcess(
|
| render_process_host, level);
|
| }
|
|
|
| +void NotifyRendererUsingMemoryCoordinator(
|
| + const content::RenderProcessHost* render_process_host,
|
| + base::MemoryPressureListener::MemoryPressureLevel level) {
|
| + auto* coordinator = memory_coordinator::MemoryCoordinator::GetInstance();
|
| + DCHECK(coordinator);
|
| + coordinator->DispatchToRenderer(render_process_host->GetID(), level);
|
| +}
|
| +
|
| } // namespace
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -155,6 +164,14 @@ TabManager::TabManager()
|
| // testing seams.
|
| get_current_pressure_level_ = base::Bind(&GetCurrentPressureLevel);
|
| notify_renderer_process_ = base::Bind(&NotifyRendererProcess);
|
| + if (memory_coordinator::IsEnabled()) {
|
| + auto* coordinator = memory_coordinator::MemoryCoordinator::GetInstance();
|
| + DCHECK(coordinator);
|
| + coordinator->SetChildrenDispatchCallback(
|
| + base::Bind(&TabManager::OnMemoryPressure, base::Unretained(this)));
|
| + notify_renderer_process_ =
|
| + base::Bind(&NotifyRendererUsingMemoryCoordinator);
|
| + }
|
| }
|
|
|
| TabManager::~TabManager() {
|
|
|