Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(890)

Unified Diff: content/common/child_histogram_message_filter.cc

Issue 11682003: Serialize/Deserialize support in HistogramBase (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/child_histogram_message_filter.cc
diff --git a/content/common/child_histogram_message_filter.cc b/content/common/child_histogram_message_filter.cc
index 8aae265307f6de35127c5311008c84c6a534f9f3..750574b17bd2c0e82dcab561c98617c24a6f9492 100644
--- a/content/common/child_histogram_message_filter.cc
+++ b/content/common/child_histogram_message_filter.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/message_loop.h"
#include "base/metrics/statistics_recorder.h"
+#include "base/pickle.h"
#include "content/common/child_process.h"
#include "content/common/child_process_messages.h"
#include "content/common/child_thread.h"
@@ -57,6 +58,9 @@ void ChildHistogramMessageFilter::UploadAllHistograms(int sequence_number) {
base::StatisticsRecorder::CollectHistogramStats("ChildProcess");
// Push snapshots into our pickled_histograms_ vector.
+ // Note. Before serializing, we set the kIPCSerializationSourceFlag to all
+ // histograms. So the receiving process can distinguish them with the local
+ // histograms.
Ilya Sherman 2012/12/29 00:17:30 nit: "Note." -> "Note:"; "to all" -> "for all the"
kaiwang 2013/01/08 00:51:40 Done.
histogram_snapshot_manager_.PrepareDeltas(
base::Histogram::kIPCSerializationSourceFlag, false);
@@ -73,10 +77,13 @@ void ChildHistogramMessageFilter::RecordDelta(
const base::Histogram& histogram,
const base::HistogramSamples& snapshot) {
DCHECK_NE(0, snapshot.TotalCount());
- std::string histogram_info =
- base::Histogram::SerializeHistogramInfo(histogram, snapshot);
- pickled_histograms_.push_back(histogram_info);
+ Pickle pickle;
+ histogram.SerializeInfo(&pickle);
+ snapshot.Serialize(&pickle);
+
+ pickled_histograms_.push_back(
+ std::string(static_cast<const char*>(pickle.data()), pickle.size()));
}
void ChildHistogramMessageFilter::InconsistencyDetected(
« content/browser/histogram_synchronizer.cc ('K') | « content/browser/histogram_synchronizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698