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

Unified Diff: content/browser/histogram_synchronizer.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/browser/histogram_synchronizer.cc
diff --git a/content/browser/histogram_synchronizer.cc b/content/browser/histogram_synchronizer.cc
index 2fd3fea2bd66acd433e64496d78230f140a9ca20..38d4c5ac27453fb14c0ab87f1c5abcbf4a57a536 100644
--- a/content/browser/histogram_synchronizer.cc
+++ b/content/browser/histogram_synchronizer.cc
@@ -8,6 +8,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
+#include "base/pickle.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "content/browser/histogram_controller.h"
@@ -272,7 +273,19 @@ void HistogramSynchronizer::OnHistogramDataCollected(
for (std::vector<std::string>::const_iterator it = pickled_histograms.begin();
it < pickled_histograms.end();
++it) {
- base::Histogram::DeserializeHistogramInfo(*it);
+ Pickle pickle(it->data(), it->size());
+ PickleIterator iter(pickle);
+ base::HistogramBase* histogram =
+ base::HistogramBase::DeserializeHistogramInfo(&iter);
+ if (histogram) {
Ilya Sherman 2012/12/29 00:17:30 Optional nit: IMO it's tidier to write "if (!histo
kaiwang 2013/01/08 00:51:40 Done.
+ if (histogram->flags() &
+ base::HistogramBase::kIPCSerializationSourceFlag) {
+ DVLOG(1) << "Single process mode, histogram observed and not copied: "
+ << histogram->histogram_name();
+ } else {
+ histogram->AddSamplesFromPickle(&iter);
Ilya Sherman 2012/12/29 00:17:30 Why isn't this done as part of DeserializeHistogra
kaiwang 2013/01/08 00:51:40 IMO 1. histogram is in base/, so it should know no
Ilya Sherman 2013/01/08 22:31:53 But it already does know about inter-process commu
+ }
+ }
}
if (!request)

Powered by Google App Engine
This is Rietveld 408576698