[M120 Migration][VD] Enable direct rendering for TVPlus
[platform/framework/web/chromium-efl.git] / components / metrics / single_sample_metrics.h
1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_METRICS_SINGLE_SAMPLE_METRICS_H_
6 #define COMPONENTS_METRICS_SINGLE_SAMPLE_METRICS_H_
7
8 #include "base/functional/callback.h"
9 #include "components/metrics/public/mojom/single_sample_metrics.mojom.h"
10 #include "mojo/public/cpp/bindings/pending_receiver.h"
11
12 namespace metrics {
13
14 using CreateProviderCB = base::RepeatingCallback<void(
15     mojo::PendingReceiver<mojom::SingleSampleMetricsProvider>)>;
16
17 // Initializes and sets the base::SingleSampleMetricsFactory for the current
18 // process. |create_provider_cb| is used to create provider instances per each
19 // thread that the factory is used on; this is necessary since the underlying
20 // providers must only be used on the same thread as construction.
21 //
22 // We use a callback here to avoid taking additional DEPS on content and a
23 // service_manager::Connector() for simplicity and to avoid the need for
24 // using the service test harness in metrics unittests.
25 //
26 // Typically this is called in the process where termination may occur without
27 // warning; e.g. perhaps a renderer process.
28 extern void InitializeSingleSampleMetricsFactory(
29     CreateProviderCB create_provider_cb);
30
31 // Creates a mojom::SingleSampleMetricsProvider capable of vending single sample
32 // metrics attached to a mojo pipe.
33 //
34 // Typically this is given to a service_manager::BinderRegistry in the process
35 // that has a deterministic shutdown path and which serves as a stable endpoint
36 // for the factory created by the above initialize method in another process.
37 extern void CreateSingleSampleMetricsProvider(
38     mojo::PendingReceiver<mojom::SingleSampleMetricsProvider> receiver);
39
40 }  // namespace metrics
41
42 #endif  // COMPONENTS_METRICS_SINGLE_SAMPLE_METRICS_H_