• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2024 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.dwa.mojom;
6
7struct DwaEntry {
8  // A hash of the event name (such as "ReportingAPIUsage").
9  // Uses the same hash function as UMA.
10  // http://cs.chromium.org/chromium/src/base/metrics/metrics_hashes.cc?q=HashMetricName
11  uint64 event_hash;
12  // A hash of the content (e.g. hash("example.com")).
13  // Uses the same hash function as UMA.
14  // http://cs.chromium.org/chromium/src/base/metrics/metrics_hashes.cc?q=HashMetricName
15  uint64 content_hash;
16  // Map of names of field trials of interest. Their values are always true.
17  // Since mojom does not support set directly, we use a map to prevent
18  // duplicate keys. We should revisit this in the future to change the
19  // type to type-map it to a set.
20  map<string,bool> studies_of_interest;
21  // Map of metrics and their values that are relevant for this DWA event.
22  map<uint64,int64> metrics;
23};
24
25// Interface used for sending information from browser process to clients.
26// Lives in the browser process.
27interface DwaRecorderClientInterface {
28};
29
30// Interface used for sending DWA events from clients to the browser process.
31// Lives in the renderer process.
32interface DwaRecorderInterface {
33  // Clients call this method when the entry is ready to be logged by the
34  // recorder.
35  AddEntry(DwaEntry entry);
36};
37
38// This interface is used for building bidirectional communication between
39// browser & client.
40interface DwaRecorderFactory {
41  // The implementation of DwaRecorderClientInterface calls this method when
42  // it's first initialized.
43  CreateDwaRecorder(pending_receiver<DwaRecorderInterface> receiver,
44                    pending_remote<DwaRecorderClientInterface> client_remote);
45};
46