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

Unified Diff: chrome/browser/chromeos/arc/arc_low_memory_killer_monitor.h

Issue 1780183003: ArcLowMemoryKillerMonitor: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: histograms.xml Created 4 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
Index: chrome/browser/chromeos/arc/arc_low_memory_killer_monitor.h
diff --git a/chrome/browser/chromeos/arc/arc_low_memory_killer_monitor.h b/chrome/browser/chromeos/arc/arc_low_memory_killer_monitor.h
new file mode 100644
index 0000000000000000000000000000000000000000..773d7235e1bc73f3bf6991b66dfb8b076a58bda0
--- /dev/null
+++ b/chrome/browser/chromeos/arc/arc_low_memory_killer_monitor.h
@@ -0,0 +1,44 @@
+// Copyright 2016 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 CHROME_BROWSER_CHROMEOS_ARC_ARC_LOW_MEMORY_KILLER_MONITOR_H_
+#define CHROME_BROWSER_CHROMEOS_ARC_ARC_LOW_MEMORY_KILLER_MONITOR_H_
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/sequenced_worker_pool.h"
+
+namespace arc {
+
+// Trace lowmemorykiller events and report to UMA.
+//
+// If kernel lowmemorykiller is enabled, it would kill processes automatically
+// on memory pressure. ArcLowMemoryKillerMonitor listens on lowmemorykiller log
+// from kernel space and reports to UMA.
+//
+// Note: There should be only one ArcLowMemoryKillerMonitor instance during the
+// power cycle of a Chrome OS device, otherwise an lowmemorykiller event would
+// be reported twice since it reads in the entire kernel log from head.
+// On Chrome OS, it should live within a main browser thread.
+class ArcLowMemoryKillerMonitor {
+ public:
+ ArcLowMemoryKillerMonitor();
+ ~ArcLowMemoryKillerMonitor();
+
+ void Start();
+ void Stop();
+
+ private:
+ // Keep a reference to worker_pool_ in case |this| is deleted in
+ // shutdown process while this thread returns from a blocking read.
+ static void Run(scoped_refptr<base::SequencedWorkerPool> worker_pool);
+
+ scoped_refptr<base::SequencedWorkerPool> worker_pool_;
+
+ DISALLOW_COPY_AND_ASSIGN(ArcLowMemoryKillerMonitor);
+};
+
+} // namespace arc
+
+#endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_LOW_MEMORY_KILLER_MONITOR_H_"
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_low_memory_killer_monitor.cc » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698