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

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

Issue 2259823002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // Builds a URLRequestContext assuming there's only a single loop. 139 // Builds a URLRequestContext assuming there's only a single loop.
140 std::unique_ptr<net::URLRequestContext> BuildURLRequestContext( 140 std::unique_ptr<net::URLRequestContext> BuildURLRequestContext(
141 net::NetLog* net_log) { 141 net::NetLog* net_log) {
142 net::URLRequestContextBuilder builder; 142 net::URLRequestContextBuilder builder;
143 #if defined(OS_LINUX) 143 #if defined(OS_LINUX)
144 // On Linux, use a fixed ProxyConfigService, since the default one 144 // On Linux, use a fixed ProxyConfigService, since the default one
145 // depends on glib. 145 // depends on glib.
146 // 146 //
147 // TODO(akalin): Remove this once http://crbug.com/146421 is fixed. 147 // TODO(akalin): Remove this once http://crbug.com/146421 is fixed.
148 builder.set_proxy_config_service( 148 builder.set_proxy_config_service(
149 base::WrapUnique(new net::ProxyConfigServiceFixed(net::ProxyConfig()))); 149 base::MakeUnique<net::ProxyConfigServiceFixed>(net::ProxyConfig()));
150 #endif 150 #endif
151 std::unique_ptr<net::URLRequestContext> context(builder.Build()); 151 std::unique_ptr<net::URLRequestContext> context(builder.Build());
152 context->set_net_log(net_log); 152 context->set_net_log(net_log);
153 return context; 153 return context;
154 } 154 }
155 155
156 // Assuming that the time |server_time| was received from a server, 156 // Assuming that the time |server_time| was received from a server,
157 // that the request for the server was started on |start_ticks|, and 157 // that the request for the server was started on |start_ticks|, and
158 // that it ended on |end_ticks|, fills |server_now| with an estimate 158 // that it ended on |end_ticks|, fills |server_now| with an estimate
159 // of the current time and |server_now_uncertainty| with a 159 // of the current time and |server_now_uncertainty| with a
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 &skew, &skew_uncertainty); 319 &skew, &skew_uncertainty);
320 320
321 std::printf( 321 std::printf(
322 "An estimate for the local clock skew is %.2f ms with " 322 "An estimate for the local clock skew is %.2f ms with "
323 "uncertainty %.2f ms\n", 323 "uncertainty %.2f ms\n",
324 skew.InMillisecondsF(), 324 skew.InMillisecondsF(),
325 skew_uncertainty.InMillisecondsF()); 325 skew_uncertainty.InMillisecondsF());
326 326
327 return EXIT_SUCCESS; 327 return EXIT_SUCCESS;
328 } 328 }
OLDNEW
« no previous file with comments | « net/tools/cert_verify_tool/verify_using_path_builder.cc ('k') | net/url_request/url_fetcher_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698