Chromium Code Reviews| Index: chrome/browser/chromeos/arc/arc_process_service.h |
| diff --git a/chrome/browser/chromeos/arc/arc_process_service.h b/chrome/browser/chromeos/arc/arc_process_service.h |
| index 231c58dd7389aca66b9f7f826c2bb68b58ad46e0..3d2a8d1082370fc80921865ba589b22422faf5ef 100644 |
| --- a/chrome/browser/chromeos/arc/arc_process_service.h |
| +++ b/chrome/browser/chromeos/arc/arc_process_service.h |
| @@ -8,9 +8,10 @@ |
| #include <map> |
| #include <vector> |
|
Yusuke Sato
2016/06/30 19:46:52
nit: IWYU
#include "base/macros.h" for DISALLOW_C
|
| -#include "base/callback.h" |
| +#include "base/callback_forward.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "base/process/process_iterator.h" |
| #include "base/threading/sequenced_worker_pool.h" |
| #include "base/threading/thread_checker.h" |
| #include "chrome/browser/chromeos/arc/arc_process.h" |
| @@ -21,19 +22,26 @@ namespace arc { |
| // A single global entry to get a list of ARC processes. |
| // |
| -// Call RequestProcessList() on the main UI thread to get a list of all ARC |
| -// processes. It returns vector<arc::ArcProcess>, which includes pid <-> nspid |
| -// mapping. |
| +// Call RequestAppProcessList() / RequestSystemProcessList() on the main UI |
| +// thread to get a list of all ARC app / system processes. It returns |
| +// vector<arc::ArcProcess>, which includes pid <-> nspid mapping. |
| // Example: |
| // void OnUpdateProcessList(const vector<arc::ArcProcess>&) {...} |
| // |
| // arc::ArcProcessService* arc_process_service = |
| // arc::ArcProcessService::Get(); |
| // if (!arc_process_service || |
| -// !arc_process_service->RequestProcessList( |
| +// !arc_process_service->RequestAppProcessList( |
| // base::Bind(&OnUpdateProcessList)) { |
| // LOG(ERROR) << "ARC process instance not ready."; |
| // } |
| +// |
| +// [System Process] |
| +// The system process here is defined by the scope. If the process is produced |
| +// under system_server in Android, we regard it as one of Android app process. |
| +// Otherwise, the processes that are introduced by init would then be regarded |
| +// as System Process. RequestAppProcessList() is responsible for app processes |
| +// while RequestSystemProcessList() is responsible for System Processes. |
| class ArcProcessService : public ArcService, |
| public ArcBridgeService::Observer { |
| public: |
| @@ -51,11 +59,17 @@ class ArcProcessService : public ArcService, |
| // Returns true if ARC IPC is ready for process list request, |
| // otherwise false. |
| - bool RequestProcessList(RequestProcessListCallback callback); |
| + bool RequestAppProcessList(RequestProcessListCallback callback); |
|
Yusuke Sato
2016/06/30 19:46:52
nit: const RequestProcessListCallback&
?
|
| + void RequestSystemProcessList(RequestProcessListCallback callback); |
|
Yusuke Sato
2016/06/30 19:46:52
same
|
| private: |
| void Reset(); |
| + void GetArcSystemProcessList(std::vector<ArcProcess>* ret_processes); |
| + |
| + static base::ProcessId GetArcInitProcessId( |
| + const base::ProcessIterator::ProcessEntries& entry_list); |
| + |
| void OnReceiveProcessList( |
| const RequestProcessListCallback& callback, |
| mojo::Array<arc::mojom::RunningAppProcessInfoPtr> mojo_processes); |
| @@ -74,6 +88,9 @@ class ArcProcessService : public ArcService, |
| void UpdateNspidToPidMap(); |
| + void PostTaskToOwnThreadAndReply(const base::Closure& task, |
| + const base::Closure& reply); |
| + |
| // Keep a cache pid mapping of all arc processes so to minimize the number of |
| // nspid lookup from /proc/<PID>/status. |
| // To play safe, always modify |nspid_to_pid_| on the worker thread. |