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

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

Issue 2896073002: TabManager: Add more logs to understand how it works when memory is low. (Closed)
Patch Set: 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 #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),
19 process_name_(process_name), 21 process_name_(process_name),
20 process_state_(process_state), 22 process_state_(process_state),
21 is_focused_(is_focused), 23 is_focused_(is_focused),
22 last_activity_time_(last_activity_time) {} 24 last_activity_time_(last_activity_time) {}
23 25
24 ArcProcess::~ArcProcess() = default; 26 ArcProcess::~ArcProcess() = default;
25 27
26 // Sort by (process_state, last_activity_time) pair. 28 // Sort by (process_state, last_activity_time) pair.
27 // Smaller process_state value means higher priority as defined in Android. 29 // Smaller process_state value means higher priority as defined in Android.
28 // Larger last_activity_time means more recently used. 30 // Larger last_activity_time means more recently used.
29 bool ArcProcess::operator<(const ArcProcess& rhs) const { 31 bool ArcProcess::operator<(const ArcProcess& rhs) const {
30 return std::make_pair(process_state(), -last_activity_time()) < 32 return std::make_pair(process_state(), -last_activity_time()) <
31 std::make_pair(rhs.process_state(), -rhs.last_activity_time()); 33 std::make_pair(rhs.process_state(), -rhs.last_activity_time());
32 } 34 }
33 35
34 ArcProcess::ArcProcess(ArcProcess&& other) = default; 36 ArcProcess::ArcProcess(ArcProcess&& other) = default;
35 ArcProcess& ArcProcess::operator=(ArcProcess&& other) = default; 37 ArcProcess& ArcProcess::operator=(ArcProcess&& other) = default;
36 38
39 std::ostream& operator<<(std::ostream& out, const ArcProcess& arc_process) {
40 out << "process_name: " << arc_process.process_name()
41 << ", pid: " << arc_process.pid()
42 << ", process_state: " << arc_process.process_state()
43 << ", is_focused: " << arc_process.is_focused()
44 << ", last_activity_time: " << arc_process.last_activity_time()
45 << ", packages: " << base::JoinString(arc_process.packages(), ",");
46 return out;
47 }
48
37 } // namespace arc 49 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/process/arc_process.h ('k') | chrome/browser/memory/tab_manager_delegate_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698