| 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/arc_process.h" | 5 #include "chrome/browser/chromeos/arc/arc_process.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 namespace arc { | 9 namespace arc { |
| 8 | 10 |
| 9 ArcProcess::ArcProcess(base::ProcessId nspid, | 11 ArcProcess::ArcProcess(base::ProcessId nspid, |
| 10 base::ProcessId pid, | 12 base::ProcessId pid, |
| 11 const std::string& process_name, | 13 const std::string& process_name, |
| 12 mojom::ProcessState process_state) | 14 mojom::ProcessState process_state, |
| 15 bool is_focused, |
| 16 int64_t last_activity_time) |
| 13 : nspid_(nspid), | 17 : nspid_(nspid), |
| 14 pid_(pid), | 18 pid_(pid), |
| 15 process_name_(process_name), | 19 process_name_(process_name), |
| 16 process_state_(process_state) {} | 20 process_state_(process_state), |
| 21 is_focused_(is_focused), |
| 22 last_activity_time_(last_activity_time) {} |
| 17 | 23 |
| 18 ArcProcess::~ArcProcess() = default; | 24 ArcProcess::~ArcProcess() = default; |
| 19 | 25 |
| 26 // Sort by (process_state, last_activity_time) pair. |
| 27 // Smaller process_state value means higher priority as defined in Android. |
| 28 // Larger last_activity_time means more recently used. |
| 29 bool ArcProcess::operator<(const ArcProcess& rhs) const { |
| 30 return std::make_pair(process_state(), -last_activity_time()) < |
| 31 std::make_pair(rhs.process_state(), -rhs.last_activity_time()); |
| 32 } |
| 33 |
| 20 ArcProcess::ArcProcess(ArcProcess&& other) = default; | 34 ArcProcess::ArcProcess(ArcProcess&& other) = default; |
| 21 ArcProcess& ArcProcess::operator=(ArcProcess&& other) = default; | 35 ArcProcess& ArcProcess::operator=(ArcProcess&& other) = default; |
| 22 | 36 |
| 23 } // namespace arc | 37 } // namespace arc |
| OLD | NEW |