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

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

Issue 1081413004: [content] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_backing_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/histogram_controller.h" 10 #include "content/browser/histogram_controller.h"
(...skipping 23 matching lines...) Expand all
34 void HistogramMessageFilter::OnChildHistogramData( 34 void HistogramMessageFilter::OnChildHistogramData(
35 int sequence_number, 35 int sequence_number,
36 const std::vector<std::string>& pickled_histograms) { 36 const std::vector<std::string>& pickled_histograms) {
37 HistogramController::GetInstance()->OnHistogramDataCollected( 37 HistogramController::GetInstance()->OnHistogramDataCollected(
38 sequence_number, pickled_histograms); 38 sequence_number, pickled_histograms);
39 } 39 }
40 40
41 void HistogramMessageFilter::OnGetBrowserHistogram( 41 void HistogramMessageFilter::OnGetBrowserHistogram(
42 const std::string& name, 42 const std::string& name,
43 std::string* histogram_json) { 43 std::string* histogram_json) {
44 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 44 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
45 // Security: Only allow access to browser histograms when running in the 45 // Security: Only allow access to browser histograms when running in the
46 // context of a test. 46 // context of a test.
47 bool using_stats_collection_controller = 47 bool using_stats_collection_controller =
48 base::CommandLine::ForCurrentProcess()->HasSwitch( 48 base::CommandLine::ForCurrentProcess()->HasSwitch(
49 switches::kStatsCollectionController); 49 switches::kStatsCollectionController);
50 if (!using_stats_collection_controller) { 50 if (!using_stats_collection_controller) {
51 LOG(ERROR) << "Attempt at reading browser histogram without specifying " 51 LOG(ERROR) << "Attempt at reading browser histogram without specifying "
52 << "--" << switches::kStatsCollectionController << " switch."; 52 << "--" << switches::kStatsCollectionController << " switch.";
53 return; 53 return;
54 } 54 }
55 base::HistogramBase* histogram = 55 base::HistogramBase* histogram =
56 base::StatisticsRecorder::FindHistogram(name); 56 base::StatisticsRecorder::FindHistogram(name);
57 if (!histogram) { 57 if (!histogram) {
58 *histogram_json = "{}"; 58 *histogram_json = "{}";
59 } else { 59 } else {
60 histogram->WriteJSON(histogram_json); 60 histogram->WriteJSON(histogram_json);
61 } 61 }
62 } 62 }
63 63
64 } // namespace content 64 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_backing_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698