From 1f4fc8e8c3423981f1046fa078046b8385b77925 Mon Sep 17 00:00:00 2001 From: "jar@chromium.org" Date: Sat, 2 Jan 2010 00:46:41 +0000 Subject: Upload renderer histograms to browser after a page loads WARNING: We need to watch the perf charts when this lands to be sure that it doesn't cause a regression. Since there is no finalizer for a renderer, and some renderers are just terminated with no warning, the only way to get consistent page data is to send it to the browser after each page loads. That is the bulk of this change. I also fixed up a few nits relating to making this work in single process mode. BUG=16495 r=raman.tenneti Review URL: http://codereview.chromium.org/515072 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35431 0039d316-1c4b-4281-b951-d872f2087c98 --- base/histogram.cc | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'base/histogram.cc') diff --git a/base/histogram.cc b/base/histogram.cc index 03478d7..c7a64af 100644 --- a/base/histogram.cc +++ b/base/histogram.cc @@ -392,7 +392,7 @@ std::string Histogram::SerializeHistogramInfo(const Histogram& histogram, pickle.WriteInt(histogram.declared_max()); pickle.WriteSize(histogram.bucket_count()); pickle.WriteInt(histogram.histogram_type()); - pickle.WriteInt(histogram.flags() & ~kIPCSerializationSourceFlag); + pickle.WriteInt(histogram.flags()); snapshot.Serialize(&pickle); return std::string(static_cast(pickle.data()), pickle.size()); @@ -425,6 +425,7 @@ bool Histogram::DeserializeHistogramInfo(const std::string& histogram_info) { LOG(ERROR) << "Pickle error decoding Histogram: " << histogram_name; return false; } + DCHECK(pickle_flags & kIPCSerializationSourceFlag); // Since these fields may have come from an untrusted renderer, do additional // checks above and beyond those in Histogram::Initialize() if (declared_max <= 0 || declared_min <= 0 || declared_max < declared_min || @@ -798,21 +799,6 @@ void StatisticsRecorder::GetHistograms(Histograms* output) { } } -// static -void StatisticsRecorder::GetHistogramsForRenderer(Histograms* output) { - if (!histograms_) - return; - AutoLock auto_lock(*lock_); - for (HistogramMap::iterator it = histograms_->begin(); - histograms_->end() != it; - ++it) { - scoped_refptr histogram = it->second; - if (!(histogram->flags() & Histogram::kIPCSerializationSourceFlag)) - histogram->SetFlags(Histogram::kIPCSerializationSourceFlag); - output->push_back(histogram); - } -} - bool StatisticsRecorder::FindHistogram(const std::string& name, scoped_refptr* histogram) { if (!histograms_) -- cgit v1.1