| OLD | NEW |
| 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 #include "chrome/browser/chromeos/arc/process/arc_process.h" | 5 #include "chrome/browser/chromeos/arc/process/arc_process.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" |
| 10 |
| 9 namespace arc { | 11 namespace arc { |
| 10 | 12 |
| 11 ArcProcess::ArcProcess(base::ProcessId nspid, | 13 ArcProcess::ArcProcess(base::ProcessId nspid, |
| 12 base::ProcessId pid, | 14 base::ProcessId pid, |
| 13 const std::string& process_name, | 15 const std::string& process_name, |
| 14 mojom::ProcessState process_state, | 16 mojom::ProcessState process_state, |
| 15 bool is_focused, | 17 bool is_focused, |
| 16 int64_t last_activity_time) | 18 int64_t last_activity_time) |
| 17 : nspid_(nspid), | 19 : nspid_(nspid), |
| 18 pid_(pid), | 20 pid_(pid), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 38 return process_state() <= mojom::ProcessState::IMPORTANT_FOREGROUND; | 40 return process_state() <= mojom::ProcessState::IMPORTANT_FOREGROUND; |
| 39 } | 41 } |
| 40 | 42 |
| 41 bool ArcProcess::IsKernelKillable() const { | 43 bool ArcProcess::IsKernelKillable() const { |
| 42 // Protect PERSISTENT, PERSISTENT_UI, and our HOME processes since they should | 44 // Protect PERSISTENT, PERSISTENT_UI, and our HOME processes since they should |
| 43 // never be killed even by the kernel. Returning false for them allows their | 45 // never be killed even by the kernel. Returning false for them allows their |
| 44 // OOM adjustment scores to remain negative. | 46 // OOM adjustment scores to remain negative. |
| 45 return process_state() > arc::mojom::ProcessState::PERSISTENT_UI; | 47 return process_state() > arc::mojom::ProcessState::PERSISTENT_UI; |
| 46 } | 48 } |
| 47 | 49 |
| 50 std::ostream& operator<<(std::ostream& out, const ArcProcess& arc_process) { |
| 51 out << "process_name: " << arc_process.process_name() |
| 52 << ", pid: " << arc_process.pid() |
| 53 << ", process_state: " << arc_process.process_state() |
| 54 << ", is_focused: " << arc_process.is_focused() |
| 55 << ", last_activity_time: " << arc_process.last_activity_time() |
| 56 << ", packages: " << base::JoinString(arc_process.packages(), ","); |
| 57 return out; |
| 58 } |
| 59 |
| 48 } // namespace arc | 60 } // namespace arc |
| OLD | NEW |