| 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..9dd365804f4cc0307a2ffa30ea5c280c4b5615f7
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/arc/arc_low_memory_killer_monitor.h
|
| @@ -0,0 +1,47 @@
|
| +// 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/memory/weak_ptr.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:
|
| + void Run();
|
| +
|
| + scoped_refptr<base::SequencedWorkerPool> worker_pool_;
|
| +
|
| + // Always keep this the last member of this class to make sure it's the
|
| + // first thing to be destructed.
|
| + base::WeakPtrFactory<ArcLowMemoryKillerMonitor> weak_ptr_factory_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ArcLowMemoryKillerMonitor);
|
| +};
|
| +
|
| +} // namespace arc
|
| +
|
| +#endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_LOW_MEMORY_KILLER_MONITOR_H_"
|
|
|