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

Side by Side Diff: chrome/browser/chromeos/arc/process/arc_process.h

Issue 2874543002: Refactor ARC OOM handler code (Closed)
Patch Set: rebase Created 3 years, 7 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_PROCESS_ARC_PROCESS_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_PROCESS_ARC_PROCESS_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_PROCESS_ARC_PROCESS_H_ 6 #define CHROME_BROWSER_CHROMEOS_ARC_PROCESS_ARC_PROCESS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 21 matching lines...) Expand all
32 32
33 base::ProcessId nspid() const { return nspid_; } 33 base::ProcessId nspid() const { return nspid_; }
34 base::ProcessId pid() const { return pid_; } 34 base::ProcessId pid() const { return pid_; }
35 const std::string& process_name() const { return process_name_; } 35 const std::string& process_name() const { return process_name_; }
36 mojom::ProcessState process_state() const { return process_state_; } 36 mojom::ProcessState process_state() const { return process_state_; }
37 bool is_focused() const { return is_focused_; } 37 bool is_focused() const { return is_focused_; }
38 int64_t last_activity_time() const { return last_activity_time_; } 38 int64_t last_activity_time() const { return last_activity_time_; }
39 std::vector<std::string>& packages() { return packages_; } 39 std::vector<std::string>& packages() { return packages_; }
40 const std::vector<std::string>& packages() const { return packages_; } 40 const std::vector<std::string>& packages() const { return packages_; }
41 41
42 // Returns true if the process is likely visible to the user. When it is
43 // visible, Chrome should not kill the process.
44 bool IsUserVisible() const;
45
46 // Returns true if it is okay for the kernel OOM killer to kill the process.
47 // TODO(cylee|yusukes): Check what stock Android does for handling OOM and
48 // adjust IsUserVisible() and/or IsKillableForKernel() as needed.
49 // crbug.com/719537
50 bool IsKillableForKernel() const;
Luis Héctor Chávez 2017/05/09 23:00:10 nit: IsKillableByKernel() or IsKernelKillable()
Yusuke Sato 2017/05/09 23:20:12 Done.
51
42 private: 52 private:
43 base::ProcessId nspid_; 53 base::ProcessId nspid_;
44 base::ProcessId pid_; 54 base::ProcessId pid_;
45 std::string process_name_; 55 std::string process_name_;
46 mojom::ProcessState process_state_; 56 mojom::ProcessState process_state_;
47 // If the Android app is the focused window. 57 // If the Android app is the focused window.
48 bool is_focused_; 58 bool is_focused_;
49 // A monotonic timer recording the last time this process was active. 59 // A monotonic timer recording the last time this process was active.
50 // Milliseconds since Android boot. This info is passed from Android 60 // Milliseconds since Android boot. This info is passed from Android
51 // ActivityManagerService via IPC. 61 // ActivityManagerService via IPC.
52 int64_t last_activity_time_; 62 int64_t last_activity_time_;
53 std::vector<std::string> packages_; 63 std::vector<std::string> packages_;
54 64
55 DISALLOW_COPY_AND_ASSIGN(ArcProcess); 65 DISALLOW_COPY_AND_ASSIGN(ArcProcess);
56 }; 66 };
57 67
58 } // namespace arc 68 } // namespace arc
59 69
60 #endif // CHROME_BROWSER_CHROMEOS_ARC_PROCESS_ARC_PROCESS_H_ 70 #endif // CHROME_BROWSER_CHROMEOS_ARC_PROCESS_ARC_PROCESS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/process/arc_process.cc » ('j') | chrome/browser/chromeos/arc/process/arc_process.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698