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

Side by Side Diff: base/metrics/histogram.cc

Issue 7215034: Apply CSP to chrome: and about: pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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
« no previous file with comments | « no previous file | base/tracked_objects.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Histogram is an object that aggregates statistics, and can summarize them in 5 // Histogram is an object that aggregates statistics, and can summarize them in
6 // various forms, including ASCII graphical, HTML, and numerically (as a 6 // various forms, including ASCII graphical, HTML, and numerically (as a
7 // vector of numbers corresponding to each of the aggregating buckets). 7 // vector of numbers corresponding to each of the aggregating buckets).
8 // See header file for details and examples. 8 // See header file for details and examples.
9 9
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 histogram = it->second; 1057 histogram = it->second;
1058 } 1058 }
1059 return histogram; 1059 return histogram;
1060 } 1060 }
1061 1061
1062 // static 1062 // static
1063 void StatisticsRecorder::WriteHTMLGraph(const std::string& query, 1063 void StatisticsRecorder::WriteHTMLGraph(const std::string& query,
1064 std::string* output) { 1064 std::string* output) {
1065 if (!IsActive()) 1065 if (!IsActive())
1066 return; 1066 return;
1067 output->append("<html><head><title>About Histograms");
1068 if (!query.empty())
1069 output->append(" - " + query);
1070 output->append("</title>"
1071 // We'd like the following no-cache... but it doesn't work.
1072 // "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">"
1073 "</head><body>");
1074 1067
1075 Histograms snapshot; 1068 Histograms snapshot;
1076 GetSnapshot(query, &snapshot); 1069 GetSnapshot(query, &snapshot);
1077 for (Histograms::iterator it = snapshot.begin(); 1070 for (Histograms::iterator it = snapshot.begin();
1078 it != snapshot.end(); 1071 it != snapshot.end();
1079 ++it) { 1072 ++it) {
1080 (*it)->WriteHTMLGraph(output); 1073 (*it)->WriteHTMLGraph(output);
1081 output->append("<br><hr><br>"); 1074 output->append("<br><hr><br>");
1082 } 1075 }
1083 output->append("</body></html>");
1084 } 1076 }
1085 1077
1086 // static 1078 // static
1087 void StatisticsRecorder::WriteGraph(const std::string& query, 1079 void StatisticsRecorder::WriteGraph(const std::string& query,
1088 std::string* output) { 1080 std::string* output) {
1089 if (!IsActive()) 1081 if (!IsActive())
1090 return; 1082 return;
1091 if (query.length()) 1083 if (query.length())
1092 StringAppendF(output, "Collections of histograms for %s\n", query.c_str()); 1084 StringAppendF(output, "Collections of histograms for %s\n", query.c_str());
1093 else 1085 else
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 } 1141 }
1150 1142
1151 // static 1143 // static
1152 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; 1144 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL;
1153 // static 1145 // static
1154 base::Lock* StatisticsRecorder::lock_ = NULL; 1146 base::Lock* StatisticsRecorder::lock_ = NULL;
1155 // static 1147 // static
1156 bool StatisticsRecorder::dump_on_exit_ = false; 1148 bool StatisticsRecorder::dump_on_exit_ = false;
1157 1149
1158 } // namespace base 1150 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/tracked_objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698