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

Side by Side Diff: chrome/browser/net/dns_host_info.cc

Issue 2890: Include chrome/browser/SConscript in Linux build.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 3 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 | « chrome/browser/net/dns_host_info.h ('k') | chrome/browser/printing/page_number.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // See header file for description of class 5 // See header file for description of class
6 6
7 #include "chrome/browser/net/dns_host_info.h" 7 #include "chrome/browser/net/dns_host_info.h"
8 8
9 #include <math.h> 9 #include <math.h>
10 10
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 //------------------------------------------------------------------------------ 196 //------------------------------------------------------------------------------
197 // This last section supports HTML output, such as seen in about:dns. 197 // This last section supports HTML output, such as seen in about:dns.
198 //------------------------------------------------------------------------------ 198 //------------------------------------------------------------------------------
199 199
200 // Preclude any possibility of Java Script or markup in the text, by only 200 // Preclude any possibility of Java Script or markup in the text, by only
201 // allowing alphanumerics, ".", and whitespace. 201 // allowing alphanumerics, ".", and whitespace.
202 static std::string RemoveJs(const std::string& text) { 202 static std::string RemoveJs(const std::string& text) {
203 std::string output(text); 203 std::string output(text);
204 size_t length = output.length(); 204 size_t length = output.length();
205 for (size_t i = 0; i < 1; i++) { 205 for (size_t i = 0; i < length; i++) {
206 char next = output[i]; 206 char next = output[i];
207 if (isalnum(next) || isspace(next) || '.' == next) 207 if (isalnum(next) || isspace(next) || '.' == next)
208 continue; 208 continue;
209 output[i] = '?'; 209 output[i] = '?';
210 } 210 }
211 return output; 211 return output;
212 } 212 }
213 213
214 class MinMaxAverage { 214 class MinMaxAverage {
215 public: 215 public:
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 return; 272 return;
273 output->append(description); 273 output->append(description);
274 StringAppendF(output, "%d %s", host_infos.size(), 274 StringAppendF(output, "%d %s", host_infos.size(),
275 (1 == host_infos.size()) ? "hostname" : "hostnames"); 275 (1 == host_infos.size()) ? "hostname" : "hostnames");
276 276
277 if (brief) { 277 if (brief) {
278 output->append("<br><br>"); 278 output->append("<br><br>");
279 return; 279 return;
280 } 280 }
281 281
282 char* row_format = "<tr align=right><td>%s</td>" 282 const char* row_format = "<tr align=right><td>%s</td>"
283 "<td>%d</td><td>%d</td><td>%s</td></tr>"; 283 "<td>%d</td><td>%d</td><td>%s</td></tr>";
284 284
285 output->append("<br><table border=1>"); 285 output->append("<br><table border=1>");
286 StringAppendF(output, "<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>", 286 StringAppendF(output, "<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>",
287 "Host name", "Applicable Prefetch<br>Time (ms)", 287 "Host name", "Applicable Prefetch<br>Time (ms)",
288 "Recent Resolution<br>Time(ms)", "How long ago<br>(HH:MM:SS)"); 288 "Recent Resolution<br>Time(ms)", "How long ago<br>(HH:MM:SS)");
289 289
290 // Print bulk of table, and gather stats at same time. 290 // Print bulk of table, and gather stats at same time.
291 MinMaxAverage queue, resolve, preresolve, when; 291 MinMaxAverage queue, resolve, preresolve, when;
292 TimeTicks current_time = TimeTicks::Now(); 292 TimeTicks current_time = TimeTicks::Now();
293 for (DnsInfoTable::const_iterator it(host_infos.begin()); 293 for (DnsInfoTable::const_iterator it(host_infos.begin());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 #ifdef DEBUG 328 #ifdef DEBUG
329 StringAppendF(output, 329 StringAppendF(output,
330 "Prefetch Queue Durations: min=%d, avg=%d, max=%d<br><br>", 330 "Prefetch Queue Durations: min=%d, avg=%d, max=%d<br><br>",
331 queue.minimum(), queue.average(), queue.maximum()); 331 queue.minimum(), queue.average(), queue.maximum());
332 #endif 332 #endif
333 333
334 output->append("<br>"); 334 output->append("<br>");
335 } 335 }
336 } // namespace chrome_browser_net 336 } // namespace chrome_browser_net
337 337
OLDNEW
« no previous file with comments | « chrome/browser/net/dns_host_info.h ('k') | chrome/browser/printing/page_number.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698