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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_LOW_MEMORY_KILLER_MONITOR_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_LOW_MEMORY_KILLER_MONITOR_H_
7
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/threading/sequenced_worker_pool.h"
12
13 namespace arc {
14
15 // Trace lowmemorykiller events and report to UMA.
16 //
17 // If kernel lowmemorykiller is enabled, it would kill processes automatically
18 // on memory pressure. ArcLowMemoryKillerMonitor listens on lowmemorykiller log
19 // from kernel space and reports to UMA.
20 //
21 // Note: There should be only one ArcLowMemoryKillerMonitor instance during the
22 // power cycle of a Chrome OS device, otherwise an lowmemorykiller event would
23 // be reported twice since it reads in the entire kernel log from head.
24 // On Chrome OS, it should live within a main browser thread.
25 class ArcLowMemoryKillerMonitor {
26 public:
27 ArcLowMemoryKillerMonitor();
28 ~ArcLowMemoryKillerMonitor();
29
30 void Start();
31 void Stop();
32
33 private:
34 void Run();
35
36 scoped_refptr<base::SequencedWorkerPool> worker_pool_;
37
38 // Always keep this the last member of this class to make sure it's the
39 // first thing to be destructed.
40 base::WeakPtrFactory<ArcLowMemoryKillerMonitor> weak_ptr_factory_;
41
42 DISALLOW_COPY_AND_ASSIGN(ArcLowMemoryKillerMonitor);
43 };
44
45 } // namespace arc
46
47 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_LOW_MEMORY_KILLER_MONITOR_H_"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698