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

Side by Side Diff: chrome/browser/task_manager/providers/arc/arc_process_task_provider.cc

Issue 2655633002: [task_manager] Add ARC process whitelist. (Closed)
Patch Set: Address comments. Created 3 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/task_manager/providers/arc/arc_process_task_provider.h" 5 #include "chrome/browser/task_manager/providers/arc/arc_process_task_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 // NB: |processes| can be already stale here because it is sent via IPC, and 54 // NB: |processes| can be already stale here because it is sent via IPC, and
55 // we can never avoid that. See also the comment at the declaration of 55 // we can never avoid that. See also the comment at the declaration of
56 // ArcProcessTaskProvider. 56 // ArcProcessTaskProvider.
57 57
58 set<ProcessId> nspid_to_remove; 58 set<ProcessId> nspid_to_remove;
59 for (const auto& entry : *pid_to_task) 59 for (const auto& entry : *pid_to_task)
60 nspid_to_remove.insert(entry.first); 60 nspid_to_remove.insert(entry.first);
61 61
62 for (const auto& entry : processes) { 62 for (const auto& entry : processes) {
63 // Skip adding or updating processes we will not display.
64 if (!process_filter_.ShouldDisplayProcess(entry))
65 continue;
66
63 if (nspid_to_remove.erase(entry.nspid()) == 0) { 67 if (nspid_to_remove.erase(entry.nspid()) == 0) {
64 // New arc process. 68 // New arc process.
65 std::unique_ptr<ArcProcessTask>& task = (*pid_to_task)[entry.nspid()]; 69 std::unique_ptr<ArcProcessTask>& task = (*pid_to_task)[entry.nspid()];
66 // After calling NotifyObserverTaskAdded(), the raw pointer of |task| is 70 // After calling NotifyObserverTaskAdded(), the raw pointer of |task| is
67 // remebered somewhere else. One should not (implicitly) delete the 71 // remebered somewhere else. One should not (implicitly) delete the
68 // referenced object before calling NotifyObserverTaskRemoved() first 72 // referenced object before calling NotifyObserverTaskRemoved() first
69 // (crbug.com/587707). 73 // (crbug.com/587707).
70 DCHECK(!task.get()) << 74 DCHECK(!task.get()) <<
71 "Task with the same pid should not be added twice."; 75 "Task with the same pid should not be added twice.";
72 task.reset(new ArcProcessTask(entry.pid(), entry.nspid(), 76 task.reset(new ArcProcessTask(entry.pid(), entry.nspid(),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 160 }
157 161
158 void ArcProcessTaskProvider::ScheduleNextSystemRequest() { 162 void ArcProcessTaskProvider::ScheduleNextSystemRequest() {
159 ScheduleNextRequest( 163 ScheduleNextRequest(
160 base::Bind(&ArcProcessTaskProvider::RequestSystemProcessList, 164 base::Bind(&ArcProcessTaskProvider::RequestSystemProcessList,
161 weak_ptr_factory_.GetWeakPtr()), 165 weak_ptr_factory_.GetWeakPtr()),
162 kUpdateSystemProcessListDelaySeconds); 166 kUpdateSystemProcessListDelaySeconds);
163 } 167 }
164 168
165 } // namespace task_manager 169 } // namespace task_manager
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/providers/arc/arc_process_task_provider.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698