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

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

Issue 1303493002: Make UrlRequestContextBuilder take scoped_ptr's (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync and fix tiny resulting build failure Created 5 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
« no previous file with comments | « mojo/services/network/network_context.cc ('k') | net/url_request/url_request_context_builder.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) 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // Builds a URLRequestContext assuming there's only a single loop. 137 // Builds a URLRequestContext assuming there's only a single loop.
138 scoped_ptr<net::URLRequestContext> 138 scoped_ptr<net::URLRequestContext>
139 BuildURLRequestContext(net::NetLog* net_log) { 139 BuildURLRequestContext(net::NetLog* net_log) {
140 net::URLRequestContextBuilder builder; 140 net::URLRequestContextBuilder builder;
141 #if defined(OS_LINUX) 141 #if defined(OS_LINUX)
142 // On Linux, use a fixed ProxyConfigService, since the default one 142 // On Linux, use a fixed ProxyConfigService, since the default one
143 // depends on glib. 143 // depends on glib.
144 // 144 //
145 // TODO(akalin): Remove this once http://crbug.com/146421 is fixed. 145 // TODO(akalin): Remove this once http://crbug.com/146421 is fixed.
146 builder.set_proxy_config_service( 146 builder.set_proxy_config_service(
147 new net::ProxyConfigServiceFixed(net::ProxyConfig())); 147 make_scoped_ptr(new net::ProxyConfigServiceFixed(net::ProxyConfig())));
148 #endif 148 #endif
149 scoped_ptr<net::URLRequestContext> context(builder.Build()); 149 scoped_ptr<net::URLRequestContext> context(builder.Build());
150 context->set_net_log(net_log); 150 context->set_net_log(net_log);
151 return context.Pass(); 151 return context.Pass();
152 } 152 }
153 153
154 // Assuming that the time |server_time| was received from a server, 154 // Assuming that the time |server_time| was received from a server,
155 // that the request for the server was started on |start_ticks|, and 155 // that the request for the server was started on |start_ticks|, and
156 // that it ended on |end_ticks|, fills |server_now| with an estimate 156 // that it ended on |end_ticks|, fills |server_now| with an estimate
157 // of the current time and |server_now_uncertainty| with a 157 // of the current time and |server_now_uncertainty| with a
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 &skew, &skew_uncertainty); 317 &skew, &skew_uncertainty);
318 318
319 std::printf( 319 std::printf(
320 "An estimate for the local clock skew is %.2f ms with " 320 "An estimate for the local clock skew is %.2f ms with "
321 "uncertainty %.2f ms\n", 321 "uncertainty %.2f ms\n",
322 skew.InMillisecondsF(), 322 skew.InMillisecondsF(),
323 skew_uncertainty.InMillisecondsF()); 323 skew_uncertainty.InMillisecondsF());
324 324
325 return EXIT_SUCCESS; 325 return EXIT_SUCCESS;
326 } 326 }
OLDNEW
« no previous file with comments | « mojo/services/network/network_context.cc ('k') | net/url_request/url_request_context_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698