1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_FRAME_HISTOGRAM_SNAPSHOTS_H_
6 #define CHROME_FRAME_HISTOGRAM_SNAPSHOTS_H_
12 #include "base/basictypes.h"
13 #include "base/histogram.h"
14 #include "base/process.h"
15 #include "base/scoped_ptr.h"
16 #include "base/task.h"
18 // This class gathers histogram data in the host browser process and
19 // serializes the data into a vector of strings to be uploaded to the
20 // Chrome browser process. It records the histogram data which has been
21 // logged and only uploads the delta with the next log.
23 // This class does not contain any ChromeFrame specific stuff. It should
25 class ChromeFrameHistogramSnapshots
{
27 // Maintain a map of histogram names to the sample stats we've sent.
28 typedef std::map
<std::string
, Histogram::SampleSet
> LoggedSampleMap
;
29 typedef std::vector
<std::string
> HistogramPickledList
;
31 ChromeFrameHistogramSnapshots();
32 ~ChromeFrameHistogramSnapshots() {}
34 // Extract snapshot data and return it to be sent off to the Chrome browser
36 // Return only a delta to what we have already sent.
37 HistogramPickledList
GatherAllHistograms();
40 void GatherHistogram(const Histogram
& histogram
,
41 HistogramPickledList
* histograms
);
43 void GatherHistogramDelta(const Histogram
& histogram
,
44 const Histogram::SampleSet
& snapshot
,
45 HistogramPickledList
* histograms
);
47 // For histograms, record what we've already logged (as a sample for each
48 // histogram) so that we can send only the delta with the next log.
49 LoggedSampleMap logged_samples_
;
51 // Synchronizes the histogram gathering operation.
54 DISALLOW_COPY_AND_ASSIGN(ChromeFrameHistogramSnapshots
);
57 #endif // CHROME_RENDERER_HISTOGRAM_SNAPSHOTS_H_