xref: /aosp_15_r20/external/cronet/components/metrics/public/mojom/histogram_fetcher.mojom (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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
5module metrics.mojom;
6
7import "mojo/public/mojom/base/byte_string.mojom";
8import "mojo/public/mojom/base/shared_memory.mojom";
9
10// These values are persisted to logs. Entries should not be renumbered and
11// numeric values should never be reused. If you add any entries to this enum,
12// you must also update the corresponding enum UmaChildPingStatus at
13// tools/metrics/histograms/enums.xml.
14enum UmaChildPingStatus {
15  BROWSER_SENT_IPC = 0,
16  CHILD_RECEIVED_IPC = 1,
17  BROWSER_REPLY_CALLBACK = 2,
18};
19
20enum UmaPingCallSource {
21  PERIODIC,
22  SHARED_MEMORY_SET_UP,
23};
24
25// Used to 1) pass a shared memory segment where the child process will store
26// histograms, and 2) create a ChildHistogramFetcher so that the child process
27// can report to the browser process the histograms that could not be stored on
28// the shared memory (e.g. they were emitted before it was set up).
29interface ChildHistogramFetcherFactory {
30  // Creates a ChildHistogram interface that uses shared memory buffer to
31  // store histograms that are to be reported by the browser process to UMA.
32  CreateFetcher(
33      mojo_base.mojom.UnsafeSharedMemoryRegion? shared_memory,
34      pending_receiver<ChildHistogramFetcher> child_histogram_fetcher);
35};
36
37// Used by the browser process to request non-persistent histograms (i.e., not
38// on the shared memory) from a child process.
39interface ChildHistogramFetcher {
40  // Send to all the child processes to send back histogram data.
41  GetChildNonPersistentHistogramData()
42      => (array<mojo_base.mojom.ByteString> deltas);
43
44  // Ping-pong mechanism to quantify child process histogram losses. See
45  // implementation and call site for details.
46  Ping(UmaPingCallSource call_source) => ();
47};
48