OLD | NEW |
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // Simply quits the current message loop when finished. Used to make | 69 // Simply quits the current message loop when finished. Used to make |
70 // URLFetcher synchronous. | 70 // URLFetcher synchronous. |
71 class QuitDelegate : public net::URLFetcherDelegate { | 71 class QuitDelegate : public net::URLFetcherDelegate { |
72 public: | 72 public: |
73 QuitDelegate() {} | 73 QuitDelegate() {} |
74 | 74 |
75 ~QuitDelegate() override {} | 75 ~QuitDelegate() override {} |
76 | 76 |
77 // net::URLFetcherDelegate implementation. | 77 // net::URLFetcherDelegate implementation. |
78 void OnURLFetchComplete(const net::URLFetcher* source) override { | 78 void OnURLFetchComplete(const net::URLFetcher* source) override { |
79 base::MessageLoop::current()->Quit(); | 79 base::MessageLoop::current()->QuitWhenIdle(); |
80 } | 80 } |
81 | 81 |
82 void OnURLFetchDownloadProgress(const net::URLFetcher* source, | 82 void OnURLFetchDownloadProgress(const net::URLFetcher* source, |
83 int64 current, | 83 int64 current, |
84 int64 total) override { | 84 int64 total) override { |
85 NOTREACHED(); | 85 NOTREACHED(); |
86 } | 86 } |
87 | 87 |
88 void OnURLFetchUploadProgress(const net::URLFetcher* source, | 88 void OnURLFetchUploadProgress(const net::URLFetcher* source, |
89 int64 current, | 89 int64 current, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |