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

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

Issue 2023643002: Add ARC app icons to the Task Manager UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert back to the original test code Created 4 years, 6 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_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 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 : nspid_to_task_) 59 for (const auto& entry : nspid_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 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(),
73 entry.pid, entry.nspid, entry.process_name, entry.process_state)); 73 entry.process_name(), entry.process_state(),
74 entry.packages()));
74 NotifyObserverTaskAdded(task.get()); 75 NotifyObserverTaskAdded(task.get());
75 } else { 76 } else {
76 // Update process state of existing process. 77 // Update process state of existing process.
77 std::unique_ptr<ArcProcessTask>& task = nspid_to_task_[entry.nspid]; 78 std::unique_ptr<ArcProcessTask>& task = nspid_to_task_[entry.nspid()];
78 DCHECK(task.get()); 79 DCHECK(task.get());
79 task->SetProcessState(entry.process_state); 80 task->SetProcessState(entry.process_state());
80 } 81 }
81 } 82 }
82 83
83 for (const auto& entry : nspid_to_remove) { 84 for (const auto& entry : nspid_to_remove) {
84 // Stale arc process. 85 // Stale arc process.
85 NotifyObserverTaskRemoved(nspid_to_task_[entry].get()); 86 NotifyObserverTaskRemoved(nspid_to_task_[entry].get());
86 nspid_to_task_.erase(entry); 87 nspid_to_task_.erase(entry);
87 } 88 }
88 ScheduleNextRequest(); 89 ScheduleNextRequest();
89 } 90 }
(...skipping 27 matching lines...) Expand all
117 // message when the process list changed. As of today, ARC does not send 118 // message when the process list changed. As of today, ARC does not send
118 // the process list unless we request it by RequestProcessList message. 119 // the process list unless we request it by RequestProcessList message.
119 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 120 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
120 FROM_HERE, 121 FROM_HERE,
121 base::Bind(&ArcProcessTaskProvider::RequestProcessList, 122 base::Bind(&ArcProcessTaskProvider::RequestProcessList,
122 weak_ptr_factory_.GetWeakPtr()), 123 weak_ptr_factory_.GetWeakPtr()),
123 base::TimeDelta::FromSeconds(kUpdateProcessListDelaySeconds)); 124 base::TimeDelta::FromSeconds(kUpdateProcessListDelaySeconds));
124 } 125 }
125 126
126 } // namespace task_management 127 } // namespace task_management
OLDNEW
« no previous file with comments | « chrome/browser/task_management/providers/arc/arc_process_task.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698