| OLD | NEW |
| (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_PROCESS_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_PROCESS_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/process/process_handle.h" | |
| 13 #include "components/arc/common/process.mojom.h" | |
| 14 | |
| 15 namespace arc { | |
| 16 | |
| 17 class ArcProcess { | |
| 18 public: | |
| 19 ArcProcess(base::ProcessId nspid, | |
| 20 base::ProcessId pid, | |
| 21 const std::string& process_name, | |
| 22 mojom::ProcessState process_state, | |
| 23 bool is_focused, | |
| 24 int64_t last_activity_time); | |
| 25 ~ArcProcess(); | |
| 26 | |
| 27 ArcProcess(ArcProcess&& other); | |
| 28 ArcProcess& operator=(ArcProcess&& other); | |
| 29 | |
| 30 // Sort by descending importance. | |
| 31 bool operator<(const ArcProcess& rhs) const; | |
| 32 | |
| 33 base::ProcessId nspid() const { return nspid_; } | |
| 34 base::ProcessId pid() const { return pid_; } | |
| 35 const std::string& process_name() const { return process_name_; } | |
| 36 mojom::ProcessState process_state() const { return process_state_; } | |
| 37 bool is_focused() const { return is_focused_; } | |
| 38 int64_t last_activity_time() const { return last_activity_time_; } | |
| 39 std::vector<std::string>& packages() { return packages_; } | |
| 40 const std::vector<std::string>& packages() const { return packages_; } | |
| 41 | |
| 42 private: | |
| 43 base::ProcessId nspid_; | |
| 44 base::ProcessId pid_; | |
| 45 std::string process_name_; | |
| 46 mojom::ProcessState process_state_; | |
| 47 // If the Android app is the focused window. | |
| 48 bool is_focused_; | |
| 49 // A monotonic timer recording the last time this process was active. | |
| 50 // Milliseconds since Android boot. This info is passed from Android | |
| 51 // ActivityManagerService via IPC. | |
| 52 int64_t last_activity_time_; | |
| 53 std::vector<std::string> packages_; | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(ArcProcess); | |
| 56 }; | |
| 57 | |
| 58 } // namespace arc | |
| 59 | |
| 60 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_PROCESS_H_ | |
| OLD | NEW |