| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |