Index: services/resource_coordinator/memory/coordinator/process_map.h |
diff --git a/services/resource_coordinator/memory/coordinator/process_map.h b/services/resource_coordinator/memory/coordinator/process_map.h |
index 64d288c114e9caa87ffd93d0aa199e270f82b2e2..e68a4a5091b5dc883b31f845b1ba738a637f2246 100644 |
--- a/services/resource_coordinator/memory/coordinator/process_map.h |
+++ b/services/resource_coordinator/memory/coordinator/process_map.h |
@@ -9,50 +9,47 @@ |
#include <vector> |
#include "base/gtest_prod_util.h" |
-#include "base/hash.h" |
#include "base/process/process_handle.h" |
#include "mojo/public/cpp/bindings/binding.h" |
-#include "services/resource_coordinator/public/interfaces/memory/memory_instrumentation.mojom.h" |
#include "services/service_manager/public/cpp/identity.h" |
#include "services/service_manager/public/interfaces/service_manager.mojom.h" |
namespace service_manager { |
class Connector; |
-} |
+} // namespace service_manager |
namespace memory_instrumentation { |
// Maintains a map from service_manager::Identity to base::ProcessId by |
// listening for connections. This allows |pid| lookup by |
-// service_manager::Identity. |
+// service_manager::Identity. The assumption is that all the processes that will |
+// register, via their client libraries, to the memory instrumentation service |
+// will also necessarily connect to the service manager. |
class ProcessMap : public service_manager::mojom::ServiceManagerListener { |
public: |
explicit ProcessMap(service_manager::Connector* connector); |
~ProcessMap() override; |
- base::ProcessId GetProcessId(service_manager::Identity identity) const; |
+ // Returns the pid for a client given its identity. |
+ base::ProcessId GetProcessId(const service_manager::Identity&) const; |
protected: |
private: |
FRIEND_TEST_ALL_PREFIXES(ProcessMapTest, TypicalCase); |
FRIEND_TEST_ALL_PREFIXES(ProcessMapTest, PresentInInit); |
+ using Identity = service_manager::Identity; |
using RunningServiceInfoPtr = service_manager::mojom::RunningServiceInfoPtr; |
- // Overridden from service_manager::mojom::ServiceManagerListener: |
+ // Overridden from service_manager::mojom::ServiceManagerListener. |
void OnInit(std::vector<RunningServiceInfoPtr> instances) override; |
- |
void OnServiceCreated(RunningServiceInfoPtr instance) override; |
- |
- void OnServiceStarted(const service_manager::Identity& identity, |
- uint32_t pid) override; |
- void OnServiceFailedToStart( |
- const service_manager::Identity& identity) override {} |
- |
- void OnServiceStopped(const service_manager::Identity& identity) override; |
+ void OnServiceStarted(const Identity&, uint32_t pid) override; |
+ void OnServiceFailedToStart(const Identity&) override; |
+ void OnServiceStopped(const Identity&) override; |
mojo::Binding<service_manager::mojom::ServiceManagerListener> binding_; |
- std::map<service_manager::Identity, base::ProcessId> instances_; |
+ std::map<Identity, base::ProcessId> instances_; |
DISALLOW_COPY_AND_ASSIGN(ProcessMap); |
}; |