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

Side by Side Diff: net/tools/get_server_time/get_server_time.cc

Issue 1059843002: Refactor NetLog::LogLevel --> NetLogCaptureMode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again to fix a merge conflict 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 | « net/tools/gdig/gdig.cc ('k') | net/udp/udp_net_log_parameters.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 // This is a small utility that snarfs the server time from the 5 // This is a small utility that snarfs the server time from the
6 // response headers of an http/https HEAD request and compares it to 6 // response headers of an http/https HEAD request and compares it to
7 // the local time. 7 // the local time.
8 // 8 //
9 // TODO(akalin): Also snarf the server time from the TLS handshake, if 9 // TODO(akalin): Also snarf the server time from the TLS handshake, if
10 // any (http://crbug.com/146090). 10 // any (http://crbug.com/146090).
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // implementations always send out an OnIPAddressChanged() message, 219 // implementations always send out an OnIPAddressChanged() message,
220 // which causes the DNS resolution to abort. It's simpler to just 220 // which causes the DNS resolution to abort. It's simpler to just
221 // not instantiate one, since only a single request is sent anyway. 221 // not instantiate one, since only a single request is sent anyway.
222 222
223 // The declaration order for net_log and printing_log_observer is 223 // The declaration order for net_log and printing_log_observer is
224 // important. The destructor of PrintingLogObserver removes itself 224 // important. The destructor of PrintingLogObserver removes itself
225 // from net_log, so net_log must be available for entire lifetime of 225 // from net_log, so net_log must be available for entire lifetime of
226 // printing_log_observer. 226 // printing_log_observer.
227 net::NetLog net_log; 227 net::NetLog net_log;
228 PrintingLogObserver printing_log_observer; 228 PrintingLogObserver printing_log_observer;
229 net_log.DeprecatedAddObserver(&printing_log_observer, net::NetLog::LOG_ALL); 229 net_log.DeprecatedAddObserver(&printing_log_observer,
230 net::NetLogCaptureMode::IncludeSocketBytes());
230 231
231 QuitDelegate delegate; 232 QuitDelegate delegate;
232 scoped_ptr<net::URLFetcher> fetcher( 233 scoped_ptr<net::URLFetcher> fetcher(
233 net::URLFetcher::Create(url, net::URLFetcher::HEAD, &delegate)); 234 net::URLFetcher::Create(url, net::URLFetcher::HEAD, &delegate));
234 scoped_ptr<net::URLRequestContext> url_request_context( 235 scoped_ptr<net::URLRequestContext> url_request_context(
235 BuildURLRequestContext(&net_log)); 236 BuildURLRequestContext(&net_log));
236 fetcher->SetRequestContext( 237 fetcher->SetRequestContext(
237 // Since there's only a single thread, there's no need to worry 238 // Since there's only a single thread, there's no need to worry
238 // about when the URLRequestContext gets created. 239 // about when the URLRequestContext gets created.
239 // The URLFetcher will take a reference on the object, and hence 240 // The URLFetcher will take a reference on the object, and hence
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 &skew, &skew_uncertainty); 317 &skew, &skew_uncertainty);
317 318
318 std::printf( 319 std::printf(
319 "An estimate for the local clock skew is %.2f ms with " 320 "An estimate for the local clock skew is %.2f ms with "
320 "uncertainty %.2f ms\n", 321 "uncertainty %.2f ms\n",
321 skew.InMillisecondsF(), 322 skew.InMillisecondsF(),
322 skew_uncertainty.InMillisecondsF()); 323 skew_uncertainty.InMillisecondsF());
323 324
324 return EXIT_SUCCESS; 325 return EXIT_SUCCESS;
325 } 326 }
OLDNEW
« no previous file with comments | « net/tools/gdig/gdig.cc ('k') | net/udp/udp_net_log_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698