OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
jam
2012/05/31 16:37:04
why move this file to base? base shouldn't know an
| |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_COMMON_METRICS_HISTOGRAM_SENDER_H_ | 5 #ifndef BASE_METRICS_HISTOGRAM_SENDER_H_ |
6 #define CHROME_COMMON_METRICS_HISTOGRAM_SENDER_H_ | 6 #define BASE_METRICS_HISTOGRAM_SENDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 | 15 |
16 namespace base { | |
17 | |
16 // HistogramSender handles the logistics of gathering up available histograms | 18 // HistogramSender handles the logistics of gathering up available histograms |
17 // for transmission (such as from renderer to browser, or from browser to UMA | 19 // for transmission (such as from renderer to browser, or from browser to UMA |
18 // upload). It has several pure virtual functions that are replaced in | 20 // upload). It has several pure virtual functions that are replaced in |
19 // derived classes to allow the exact lower level transmission mechanism, | 21 // derived classes to allow the exact lower level transmission mechanism, |
20 // or error report mechanism, to be replaced. Since histograms can sit in | 22 // or error report mechanism, to be replaced. Since histograms can sit in |
21 // memory for an extended period of time, and are vulnerable to memory | 23 // memory for an extended period of time, and are vulnerable to memory |
22 // corruption, this class also validates as much rendundancy as it can before | 24 // corruption, this class also validates as much rendundancy as it can before |
23 // calling for the marginal change (a.k.a., delta) in a histogram to be sent | 25 // calling for the marginal change (a.k.a., delta) in a histogram to be sent |
24 // onward. | 26 // onward. |
25 class HistogramSender { | 27 class BASE_EXPORT HistogramSender { |
28 public: | |
29 // Send the histogram data from renderer or child processes. | |
30 virtual void SendHistograms(int sequence_number) = 0; | |
31 | |
26 protected: | 32 protected: |
27 HistogramSender(); | 33 HistogramSender(); |
28 virtual ~HistogramSender(); | 34 virtual ~HistogramSender(); |
29 | 35 |
30 // Snapshot all histograms, and transmit the delta. | 36 // Snapshot all histograms, and transmit the delta. |
31 // The arguments allow a derived class to select only a subset for | 37 // The arguments allow a derived class to select only a subset for |
32 // transmission, or to set a flag in each transmitted histogram. | 38 // transmission, or to set a flag in each transmitted histogram. |
33 void TransmitAllHistograms(base::Histogram::Flags flags_to_set, | 39 void TransmitAllHistograms(base::Histogram::Flags flags_to_set, |
34 bool send_only_uma); | 40 bool send_only_uma); |
35 | 41 |
(...skipping 21 matching lines...) Expand all Loading... | |
57 // For histograms, record what we've already transmitted (as a sample for each | 63 // For histograms, record what we've already transmitted (as a sample for each |
58 // histogram) so that we can send only the delta with the next log. | 64 // histogram) so that we can send only the delta with the next log. |
59 LoggedSampleMap logged_samples_; | 65 LoggedSampleMap logged_samples_; |
60 | 66 |
61 // List of histograms found corrupt to be corrupt, and their problems. | 67 // List of histograms found corrupt to be corrupt, and their problems. |
62 scoped_ptr<ProblemMap> inconsistencies_; | 68 scoped_ptr<ProblemMap> inconsistencies_; |
63 | 69 |
64 DISALLOW_COPY_AND_ASSIGN(HistogramSender); | 70 DISALLOW_COPY_AND_ASSIGN(HistogramSender); |
65 }; | 71 }; |
66 | 72 |
67 #endif // CHROME_COMMON_METRICS_HISTOGRAM_SENDER_H_ | 73 } // namespace base |
74 | |
75 #endif // BASE_METRICS_HISTOGRAM_SENDER_H_ | |
OLD | NEW |