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

Unified Diff: content/browser/memory/memory_condition_observer.cc

Issue 2783613002: WIP: memory coordinator: Check /dev/chromeos-low-mem to determine memory condition
Patch Set: Created 3 years, 9 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/memory/memory_condition_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/memory/memory_condition_observer.cc
diff --git a/content/browser/memory/memory_condition_observer.cc b/content/browser/memory/memory_condition_observer.cc
index 973eccf99825793a2ebab2381562c7f5b0a6ee4f..b08581936d360effe74ccb97b5ffa9f6b61217fe 100644
--- a/content/browser/memory/memory_condition_observer.cc
+++ b/content/browser/memory/memory_condition_observer.cc
@@ -64,6 +64,9 @@ MemoryConditionObserver::MemoryConditionObserver(
MemoryCoordinatorImpl* coordinator,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: coordinator_(coordinator), task_runner_(task_runner) {
+#if defined(OS_CHROMEOS)
+ low_memory_observer_ = base::MakeUnique<base::chromeos::LowMemoryObserver>();
+#endif
DCHECK(coordinator_);
InitializeParameters();
DCHECK(ValidateParameters());
@@ -95,6 +98,11 @@ void MemoryConditionObserver::SetMonitoringInterval(base::TimeDelta interval) {
}
MemoryCondition MemoryConditionObserver::CalculateNextCondition() {
+#if defined(OS_CHROMEOS)
+ if (low_memory_observer_->IsLowMemoryCondition())
+ return MemoryCondition::CRITICAL;
+#endif
+
int available =
coordinator_->memory_monitor()->GetFreeMemoryUntilCriticalMB();
« no previous file with comments | « content/browser/memory/memory_condition_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698