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

Unified Diff: base/memory/low_memory_observer_chromeos.h

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 | « base/BUILD.gn ('k') | base/memory/low_memory_observer_chromeos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/low_memory_observer_chromeos.h
diff --git a/base/memory/low_memory_observer_chromeos.h b/base/memory/low_memory_observer_chromeos.h
new file mode 100644
index 0000000000000000000000000000000000000000..b873170f02f7266d231be9a1d5677259c30a6e0b
--- /dev/null
+++ b/base/memory/low_memory_observer_chromeos.h
@@ -0,0 +1,36 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_MEMORY_LOW_MEMORY_OBSERVER_CHROMEOS_H_
+#define BASE_MEMORY_LOW_MEMORY_OBSERVER_CHROMEOS_H_
+
+#include "base/base_export.h"
+#include "base/files/scoped_file.h"
+
+namespace base {
+namespace chromeos {
+
+// TODO(bashi): Write description of the class.
+class BASE_EXPORT LowMemoryObserver {
+ public:
+ LowMemoryObserver();
+ ~LowMemoryObserver();
+
+ // Returns true when the kernel low memory observer is available.
+ bool is_valid() const { return low_mem_file_.is_valid(); }
+
+ // Checks if the kernel has detected a low memory situation. This will be
+ // called less than once a second.
+ bool IsLowMemoryCondition() const;
+
+ private:
+ ScopedFD low_mem_file_;
+
+ DISALLOW_COPY_AND_ASSIGN(LowMemoryObserver);
+};
+
+} // namespace chromeos
+} // namespace base
+
+#endif // BASE_MEMORY_LOW_MEMORY_OBSERVER_CHROMEOS_H_
« no previous file with comments | « base/BUILD.gn ('k') | base/memory/low_memory_observer_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698