| 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_management/providers/arc/arc_process_task_provider
.h" | 5 #include "chrome/browser/task_management/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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 for (const auto& entry : processes) { | 62 for (const auto& entry : processes) { |
| 63 if (nspid_to_remove.erase(entry.nspid) == 0) { | 63 if (nspid_to_remove.erase(entry.nspid) == 0) { |
| 64 // New arc process. | 64 // New arc process. |
| 65 std::unique_ptr<ArcProcessTask>& task = nspid_to_task_[entry.nspid]; | 65 std::unique_ptr<ArcProcessTask>& task = nspid_to_task_[entry.nspid]; |
| 66 // After calling NotifyObserverTaskAdded(), the raw pointer of |task| is | 66 // After calling NotifyObserverTaskAdded(), the raw pointer of |task| is |
| 67 // remebered somewhere else. One should not (implicitly) delete the | 67 // remebered somewhere else. One should not (implicitly) delete the |
| 68 // referenced object before calling NotifyObserverTaskRemoved() first | 68 // referenced object before calling NotifyObserverTaskRemoved() first |
| 69 // (crbug.com/587707). | 69 // (crbug.com/587707). |
| 70 DCHECK(!task.get()) << | 70 DCHECK(!task.get()) << |
| 71 "Task with the same pid should not be added twice."; | 71 "Task with the same pid should not be added twice."; |
| 72 task.reset(new ArcProcessTask( | 72 task.reset(new ArcProcessTask(entry.pid, entry.nspid, entry.process_name, |
| 73 entry.pid, entry.nspid, entry.process_name, entry.process_state)); | 73 entry.process_state, entry.packages)); |
| 74 NotifyObserverTaskAdded(task.get()); | 74 NotifyObserverTaskAdded(task.get()); |
| 75 } else { | 75 } else { |
| 76 // Update process state of existing process. | 76 // Update process state of existing process. |
| 77 std::unique_ptr<ArcProcessTask>& task = nspid_to_task_[entry.nspid]; | 77 std::unique_ptr<ArcProcessTask>& task = nspid_to_task_[entry.nspid]; |
| 78 DCHECK(task.get()); | 78 DCHECK(task.get()); |
| 79 task->SetProcessState(entry.process_state); | 79 task->SetProcessState(entry.process_state); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 for (const auto& entry : nspid_to_remove) { | 83 for (const auto& entry : nspid_to_remove) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // message when the process list changed. As of today, ARC does not send | 117 // message when the process list changed. As of today, ARC does not send |
| 118 // the process list unless we request it by RequestProcessList message. | 118 // the process list unless we request it by RequestProcessList message. |
| 119 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 119 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 120 FROM_HERE, | 120 FROM_HERE, |
| 121 base::Bind(&ArcProcessTaskProvider::RequestProcessList, | 121 base::Bind(&ArcProcessTaskProvider::RequestProcessList, |
| 122 weak_ptr_factory_.GetWeakPtr()), | 122 weak_ptr_factory_.GetWeakPtr()), |
| 123 base::TimeDelta::FromSeconds(kUpdateProcessListDelaySeconds)); | 123 base::TimeDelta::FromSeconds(kUpdateProcessListDelaySeconds)); |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace task_management | 126 } // namespace task_management |
| OLD | NEW |