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

Side by Side Diff: content/browser/histogram_message_filter.cc

Issue 12207058: Connect SparseHistogram with the rest of stats system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix and add tests Created 7 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/browser/histogram_message_filter.h" 5 #include "content/browser/histogram_message_filter.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/metrics/statistics_recorder.h" 9 #include "base/metrics/statistics_recorder.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 45
46 void HistogramMessageFilter::OnGetBrowserHistogram( 46 void HistogramMessageFilter::OnGetBrowserHistogram(
47 const std::string& name, 47 const std::string& name,
48 std::string* histogram_json) { 48 std::string* histogram_json) {
49 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 49 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
50 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryMetrics)) 50 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryMetrics))
51 return; 51 return;
52 if (name != "Memory.BrowserUsed") 52 if (name != "Memory.BrowserUsed")
53 return; 53 return;
54 base::Histogram* histogram = base::StatisticsRecorder::FindHistogram(name); 54 base::HistogramBase* histogram =
55 base::StatisticsRecorder::FindHistogram(name);
55 if (!histogram) { 56 if (!histogram) {
56 *histogram_json = "{}"; 57 *histogram_json = "{}";
57 } else { 58 } else {
58 histogram->WriteJSON(histogram_json); 59 histogram->WriteJSON(histogram_json);
59 } 60 }
60 } 61 }
61 62
62 } // namespace content 63 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698