Chromium Code Reviews| Index: content/browser/browser_main_loop.cc |
| diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc |
| index f4b7eae0ba294a5cd96d7e39655eff0555045ddd..214b0c7a77e8af11bce0528813cc208d3aff7054 100644 |
| --- a/content/browser/browser_main_loop.cc |
| +++ b/content/browser/browser_main_loop.cc |
| @@ -1399,6 +1399,20 @@ bool BrowserMainLoop::UsingInProcessGpu() const { |
| } |
| void BrowserMainLoop::InitializeMemoryManagementComponent() { |
| + // TODO(chrisha): Abstract away this construction mess to a helper function, |
| + // once MemoryPressureMonitor is made a concrete class. |
| +#if defined(OS_CHROMEOS) |
| + if (chromeos::switches::MemoryPressureHandlingEnabled()) { |
| + memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor( |
|
Avi (use Gerrit)
2016/11/07 04:32:01
memory_pressure_monitor_ = base::MakeUnique<base::
bashi
2016/11/07 05:53:39
Done.
|
| + chromeos::switches::GetMemoryPressureThresholds())); |
| + } |
| +#elif defined(OS_MACOSX) |
| + memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); |
|
Avi (use Gerrit)
2016/11/07 04:32:01
memory_pressure_monitor_ = base::MakeUnique<base::
bashi
2016/11/07 05:53:39
Done.
|
| +#elif defined(OS_WIN) |
| + memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( |
|
Avi (use Gerrit)
2016/11/07 04:32:01
Fix CreateWinMemoryPressureMonitor so that it retu
bashi
2016/11/07 05:53:39
Done.
|
| + parsed_command_line_)); |
| +#endif |
| + |
| if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { |
| // Disable MemoryPressureListener when memory coordinator is enabled. |
| base::MemoryPressureListener::SetNotificationsSuppressed(true); |
| @@ -1412,22 +1426,13 @@ void BrowserMainLoop::InitializeMemoryManagementComponent() { |
| SetSetCurrentMemoryStateForTestingCallback(base::Bind( |
| &MemoryCoordinator::SetCurrentMemoryStateForTesting, |
| base::Unretained(MemoryCoordinator::GetInstance()))); |
| - return; |
| - } |
| - // TODO(chrisha): Abstract away this construction mess to a helper function, |
| - // once MemoryPressureMonitor is made a concrete class. |
| -#if defined(OS_CHROMEOS) |
| - if (chromeos::switches::MemoryPressureHandlingEnabled()) { |
| - memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor( |
| - chromeos::switches::GetMemoryPressureThresholds())); |
| + if (memory_pressure_monitor_) { |
| + memory_pressure_monitor_->SetDispatchCallback( |
| + base::Bind(&MemoryCoordinator::RecordMemoryPressure, |
| + base::Unretained(MemoryCoordinator::GetInstance()))); |
| + } |
| } |
| -#elif defined(OS_MACOSX) |
| - memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); |
| -#elif defined(OS_WIN) |
| - memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( |
| - parsed_command_line_)); |
| -#endif |
| } |
| bool BrowserMainLoop::InitializeToolkit() { |