xref: /aosp_15_r20/external/cronet/components/metrics/histogram_subscriber.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2012 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_HISTOGRAM_SUBSCRIBER_H_
6 #define COMPONENTS_METRICS_HISTOGRAM_SUBSCRIBER_H_
7 
8 #include <string>
9 #include <vector>
10 
11 namespace metrics {
12 
13 // Objects interested in receiving histograms derive from HistogramSubscriber.
14 class HistogramSubscriber {
15  public:
~HistogramSubscriber()16   virtual ~HistogramSubscriber() {}
17 
18   // Send number of pending processes to subscriber. |end| is set to true if it
19   // is the last time. This is called on the UI thread.
20   virtual void OnPendingProcesses(int sequence_number,
21                                   int pending_processes,
22                                   bool end) = 0;
23 
24   // Send |histogram| back to subscriber.
25   // This is called on the UI thread.
26   virtual void OnHistogramDataCollected(
27       int sequence_number,
28       const std::vector<std::string>& pickled_histograms) = 0;
29 };
30 
31 }  // namespace metrics
32 
33 #endif  // COMPONENTS_METRICS_HISTOGRAM_SUBSCRIBER_H_
34