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

Side by Side Diff: chrome/browser/chromeos/arc/arc_process_service.cc

Issue 2095413002: TabManagerDelegate: Better prioritize ARC processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync to ToT Created 4 years, 5 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
« no previous file with comments | « chrome/browser/chromeos/arc/arc_process.cc ('k') | chrome/browser/memory/tab_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // The main point of this class is to cache ARC proc nspid<->pid mapping 5 // The main point of this class is to cache ARC proc nspid<->pid mapping
6 // globally. Since the calculation is costly, a dedicated worker thread is 6 // globally. Since the calculation is costly, a dedicated worker thread is
7 // used. All read/write of its internal data structure (i.e., the mapping) 7 // used. All read/write of its internal data structure (i.e., the mapping)
8 // should be on this thread. 8 // should be on this thread.
9 9
10 #include "chrome/browser/chromeos/arc/arc_process_service.h" 10 #include "chrome/browser/chromeos/arc/arc_process_service.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 void ArcProcessService::PopulateProcessList( 165 void ArcProcessService::PopulateProcessList(
166 const vector<arc::mojom::RunningAppProcessInfoPtr>* raw_processes, 166 const vector<arc::mojom::RunningAppProcessInfoPtr>* raw_processes,
167 vector<ArcProcess>* ret_processes) { 167 vector<ArcProcess>* ret_processes) {
168 DCHECK(thread_checker_.CalledOnValidThread()); 168 DCHECK(thread_checker_.CalledOnValidThread());
169 169
170 for (const auto& entry : *raw_processes) { 170 for (const auto& entry : *raw_processes) {
171 const auto it = nspid_to_pid_.find(entry->pid); 171 const auto it = nspid_to_pid_.find(entry->pid);
172 // In case the process already dies so couldn't find corresponding pid. 172 // In case the process already dies so couldn't find corresponding pid.
173 if (it != nspid_to_pid_.end() && it->second != kNullProcessId) { 173 if (it != nspid_to_pid_.end() && it->second != kNullProcessId) {
174 ArcProcess arc_process(entry->pid, it->second, entry->process_name, 174 ArcProcess arc_process(entry->pid, it->second, entry->process_name,
175 entry->process_state); 175 entry->process_state, entry->is_focused,
176 entry->last_activity_time);
176 // |entry->packages| is provided only when process.mojom's verion is >=4. 177 // |entry->packages| is provided only when process.mojom's verion is >=4.
177 if (entry->packages) { 178 if (entry->packages) {
178 for (const auto& package : entry->packages) { 179 for (const auto& package : entry->packages) {
179 arc_process.packages().push_back(package.get()); 180 arc_process.packages().push_back(package.get());
180 } 181 }
181 } 182 }
182 ret_processes->push_back(std::move(arc_process)); 183 ret_processes->push_back(std::move(arc_process));
183 } 184 }
184 } 185 }
185 } 186 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 nspid_to_pid_.find(nspid) != nspid_to_pid_.end()) 243 nspid_to_pid_.find(nspid) != nspid_to_pid_.end())
243 nspid_to_pid_[nspid] = pid; 244 nspid_to_pid_[nspid] = pid;
244 245
245 for (ProcessId child_pid : process_tree[pid]) 246 for (ProcessId child_pid : process_tree[pid])
246 queue.push(child_pid); 247 queue.push(child_pid);
247 } 248 }
248 } 249 }
249 } 250 }
250 251
251 } // namespace arc 252 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_process.cc ('k') | chrome/browser/memory/tab_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698