| Index: components/arc/metrics/arc_metrics_service.h
|
| diff --git a/components/arc/metrics/arc_metrics_service.h b/components/arc/metrics/arc_metrics_service.h
|
| index 4f611787a280051268a6672f7880a0ccc4952347..7b7958be491de551ee11aff82606b3bd75450b3b 100644
|
| --- a/components/arc/metrics/arc_metrics_service.h
|
| +++ b/components/arc/metrics/arc_metrics_service.h
|
| @@ -2,8 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H
|
| -#define COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H
|
| +#ifndef COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H_
|
| +#define COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H_
|
|
|
| #include "base/macros.h"
|
| #include "base/memory/weak_ptr.h"
|
| @@ -12,24 +12,28 @@
|
| #include "components/arc/arc_bridge_service.h"
|
| #include "components/arc/arc_service.h"
|
| #include "components/arc/common/arc_bridge.mojom.h"
|
| +#include "components/arc/instance_holder.h"
|
| #include "components/arc/metrics/oom_kills_monitor.h"
|
| #include "mojo/public/cpp/bindings/binding.h"
|
|
|
| namespace arc {
|
|
|
| // Collects information from other ArcServices and send UMA metrics.
|
| -class ArcMetricsService : public ArcService,
|
| - public ArcBridgeService::Observer,
|
| - public mojom::MetricsHost {
|
| +class ArcMetricsService
|
| + : public ArcService,
|
| + public InstanceHolder<mojom::MetricsInstance>::Observer,
|
| + public mojom::MetricsHost {
|
| public:
|
| explicit ArcMetricsService(ArcBridgeService* bridge_service);
|
| ~ArcMetricsService() override;
|
|
|
| - // ArcBridgeService::Observer overrides.
|
| - void OnMetricsInstanceReady() override;
|
| - void OnMetricsInstanceClosed() override;
|
| - void OnProcessInstanceReady() override;
|
| - void OnProcessInstanceClosed() override;
|
| + // InstanceHolder<mojom::MetricsInstance>::Observer overrides.
|
| + void OnInstanceReady() override;
|
| + void OnInstanceClosed() override;
|
| +
|
| + // Implementations for InstanceHolder<mojom::ProcessInstance>::Observer.
|
| + void OnProcessInstanceReady();
|
| + void OnProcessInstanceClosed();
|
|
|
| // MetricsHost overrides.
|
| void ReportBootProgress(
|
| @@ -45,8 +49,24 @@ class ArcMetricsService : public ArcService,
|
| void OnArcStartTimeRetrieved(bool success, base::TimeTicks arc_start_time);
|
|
|
| private:
|
| + // Adapter to be able to also observe ProcessInstance events.
|
| + class ProcessObserver
|
| + : public InstanceHolder<mojom::ProcessInstance>::Observer {
|
| + public:
|
| + explicit ProcessObserver(ArcMetricsService* arc_metrics_service);
|
| + ~ProcessObserver() override;
|
| +
|
| + private:
|
| + // InstanceHolder<mojom::ProcessInstance>::Observer overrides.
|
| + void OnInstanceReady() override;
|
| + void OnInstanceClosed() override;
|
| +
|
| + ArcMetricsService* arc_metrics_service_;
|
| + };
|
| +
|
| mojo::Binding<mojom::MetricsHost> binding_;
|
|
|
| + ProcessObserver process_observer_;
|
| base::ThreadChecker thread_checker_;
|
| base::RepeatingTimer timer_;
|
|
|
| @@ -63,4 +83,4 @@ class ArcMetricsService : public ArcService,
|
|
|
| } // namespace arc
|
|
|
| -#endif // COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H
|
| +#endif // COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H_
|
|
|