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

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

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 const char* const source_type = 116 const char* const source_type =
117 net::NetLog::SourceTypeToString(entry.source().type); 117 net::NetLog::SourceTypeToString(entry.source().type);
118 const char* const event_type = 118 const char* const event_type =
119 net::NetLog::EventTypeToString(entry.type()); 119 net::NetLog::EventTypeToString(entry.type());
120 const char* const event_phase = 120 const char* const event_phase =
121 net::NetLog::EventPhaseToString(entry.phase()); 121 net::NetLog::EventPhaseToString(entry.phase());
122 scoped_ptr<base::Value> params(entry.ParametersToValue()); 122 scoped_ptr<base::Value> params(entry.ParametersToValue());
123 std::string params_str; 123 std::string params_str;
124 if (params.get()) { 124 if (params.get()) {
125 base::JSONWriter::Write(params.get(), &params_str); 125 base::JSONWriter::Write(*params, &params_str);
126 params_str.insert(0, ": "); 126 params_str.insert(0, ": ");
127 } 127 }
128 128
129 VLOG(1) << source_type << "(" << entry.source().id << "): " 129 VLOG(1) << source_type << "(" << entry.source().id << "): "
130 << event_type << ": " << event_phase << params_str; 130 << event_type << ": " << event_phase << params_str;
131 } 131 }
132 132
133 private: 133 private:
134 DISALLOW_COPY_AND_ASSIGN(PrintingLogObserver); 134 DISALLOW_COPY_AND_ASSIGN(PrintingLogObserver);
135 }; 135 };
(...skipping 181 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 | « net/test/spawned_test_server/remote_test_server.cc ('k') | net/tools/net_watcher/net_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698