Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Unified Diff: content/browser/browser_main_loop.cc

Issue 2411423004: Disable MemoryPressureListener when memory coordinator is enabled (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/browser_main_loop.h ('k') | content/browser/devtools/protocol/memory_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_main_loop.cc
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 654db695c220937ce1539553af510dbc2ef08ad6..1c9742482f2ba1e74ac52851ffed7e16986b183f 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -75,6 +75,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/tracing_controller.h"
#include "content/public/common/content_client.h"
+#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/main_function_params.h"
#include "content/public/common/result_codes.h"
@@ -746,19 +747,7 @@ int BrowserMainLoop::PreCreateThreads() {
command_line->GetSwitchValueASCII(switches::kEnableFeatures),
command_line->GetSwitchValueASCII(switches::kDisableFeatures));
- // 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()));
- }
-#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
+ InitializeMemoryManagementComponent();
#if defined(ENABLE_PLUGINS)
// Prior to any processing happening on the IO thread, we create the
@@ -1396,6 +1385,28 @@ bool BrowserMainLoop::UsingInProcessGpu() const {
parsed_command_line_.HasSwitch(switches::kInProcessGPU);
}
+void BrowserMainLoop::InitializeMemoryManagementComponent() {
+ if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) {
+ // Disable MemoryPressureListener when memory coordinator is enabled.
+ base::MemoryPressureListener::SetNotificationsSuppressed(true);
+ 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()));
+ }
+#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() {
TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit");
« no previous file with comments | « content/browser/browser_main_loop.h ('k') | content/browser/devtools/protocol/memory_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698