| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 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_RENDERER_HISTOGRAM_SNAPSHOTS_H_ | 5 #ifndef CHROME_RENDERER_HISTOGRAM_SNAPSHOTS_H_ |
| 6 #define CHROME_RENDERER_HISTOGRAM_SNAPSHOTS_H_ | 6 #define CHROME_RENDERER_HISTOGRAM_SNAPSHOTS_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/histogram.h" | 15 #include "base/histogram.h" |
| 16 #include "base/process.h" | 16 #include "base/process.h" |
| 17 #include "base/scoped_ptr.h" | 17 #include "base/scoped_ptr.h" |
| 18 #include "base/task.h" | 18 #include "base/task.h" |
| 19 | 19 |
| 20 class RendererHistogramSnapshots { | 20 class RendererHistogramSnapshots { |
| 21 public: | 21 public: |
| 22 RendererHistogramSnapshots(); | 22 RendererHistogramSnapshots(); |
| 23 | 23 |
| 24 ~RendererHistogramSnapshots() {} | 24 ~RendererHistogramSnapshots() {} |
| 25 | 25 |
| 26 // Send the histogram data. | 26 // Send the histogram data. |
| 27 void SendHistograms(); | 27 void SendHistograms(int sequence_number); |
| 28 | 28 |
| 29 // Maintain a map of histogram names to the sample stats we've sent. | 29 // Maintain a map of histogram names to the sample stats we've sent. |
| 30 typedef std::map<std::string, Histogram::SampleSet> LoggedSampleMap; | 30 typedef std::map<std::string, Histogram::SampleSet> LoggedSampleMap; |
| 31 typedef std::vector<std::string> HistogramPickledList; | 31 typedef std::vector<std::string> HistogramPickledList; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 // Extract snapshot data and then send it off the the Browser process. | 34 // Extract snapshot data and then send it off the the Browser process. |
| 35 // Send only a delta to what we have already sent. | 35 // Send only a delta to what we have already sent. |
| 36 void UploadAllHistrograms(); | 36 void UploadAllHistrograms(int sequence_number); |
| 37 void UploadHistrogram(const Histogram& histogram, | 37 void UploadHistrogram(const Histogram& histogram, |
| 38 HistogramPickledList* histograms); | 38 HistogramPickledList* histograms); |
| 39 void UploadHistogramDelta(const Histogram& histogram, | 39 void UploadHistogramDelta(const Histogram& histogram, |
| 40 const Histogram::SampleSet& snapshot, | 40 const Histogram::SampleSet& snapshot, |
| 41 HistogramPickledList* histograms); | 41 HistogramPickledList* histograms); |
| 42 | 42 |
| 43 ScopedRunnableMethodFactory<RendererHistogramSnapshots> | 43 ScopedRunnableMethodFactory<RendererHistogramSnapshots> |
| 44 renderer_histogram_snapshots_factory_; | 44 renderer_histogram_snapshots_factory_; |
| 45 | 45 |
| 46 // For histograms, record what we've already logged (as a sample for each | 46 // For histograms, record what we've already logged (as a sample for each |
| 47 // histogram) so that we can send only the delta with the next log. | 47 // histogram) so that we can send only the delta with the next log. |
| 48 LoggedSampleMap logged_samples_; | 48 LoggedSampleMap logged_samples_; |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(RendererHistogramSnapshots); | 50 DISALLOW_COPY_AND_ASSIGN(RendererHistogramSnapshots); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 #endif // CHROME_RENDERER_HISTOGRAM_SNAPSHOTS_H_ | 53 #endif // CHROME_RENDERER_HISTOGRAM_SNAPSHOTS_H_ |
| OLD | NEW |