| 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..ec2c5e7df7001c82a8f4dfef0dabe0464c9f3aa4 100644
|
| --- a/chrome/browser/chromeos/arc/arc_process_service.h
|
| +++ b/chrome/browser/chromeos/arc/arc_process_service.h
|
| @@ -9,8 +9,10 @@
|
| #include <vector>
|
|
|
| #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 +23,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 +60,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);
|
| + void RequestSystemProcessList(RequestProcessListCallback callback);
|
|
|
| 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 +89,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.
|
|
|