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

Side by Side Diff: net/log/net_log_util.cc

Issue 1775663002: Replace TimeTicks::UnixEpoch with Time::UnixEpoch for the net log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "net/log/net_log_util.h" 5 #include "net/log/net_log_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 dict->SetInteger("ADDRESS_FAMILY_UNSPECIFIED", ADDRESS_FAMILY_UNSPECIFIED); 268 dict->SetInteger("ADDRESS_FAMILY_UNSPECIFIED", ADDRESS_FAMILY_UNSPECIFIED);
269 dict->SetInteger("ADDRESS_FAMILY_IPV4", ADDRESS_FAMILY_IPV4); 269 dict->SetInteger("ADDRESS_FAMILY_IPV4", ADDRESS_FAMILY_IPV4);
270 dict->SetInteger("ADDRESS_FAMILY_IPV6", ADDRESS_FAMILY_IPV6); 270 dict->SetInteger("ADDRESS_FAMILY_IPV6", ADDRESS_FAMILY_IPV6);
271 271
272 constants_dict->Set("addressFamily", std::move(dict)); 272 constants_dict->Set("addressFamily", std::move(dict));
273 } 273 }
274 274
275 // Information about how the "time ticks" values we have given it relate to 275 // Information about how the "time ticks" values we have given it relate to
276 // actual system times. Time ticks are used throughout since they are stable 276 // actual system times. Time ticks are used throughout since they are stable
277 // across system clock changes. 277 // across system clock changes.
278 // Note: |timeTickOffset| is only comparable to TimeTicks values, converted to
279 // milliseconds by subtracting the null TimeTicks.
eroman 2016/03/08 00:11:04 I am not sure what this comment means. Subtracting
Charlie Harrison 2016/03/08 01:14:46 Yeah that's what I meant. I thought saying somethi
278 { 280 {
281 base::TimeDelta time_since_epoch =
282 base::Time::Now() - base::Time::UnixEpoch();
283 base::TimeDelta reference_time_ticks =
284 base::TimeTicks::Now() - base::TimeTicks();
279 int64_t tick_to_unix_time_ms = 285 int64_t tick_to_unix_time_ms =
280 (base::TimeTicks() - base::TimeTicks::UnixEpoch()).InMilliseconds(); 286 (time_since_epoch - reference_time_ticks).InMilliseconds();
281 287
282 // Pass it as a string, since it may be too large to fit in an integer. 288 // Pass it as a string, since it may be too large to fit in an integer.
283 constants_dict->SetString("timeTickOffset", 289 constants_dict->SetString("timeTickOffset",
charliea (OOO until 10-5) 2016/03/08 17:01:42 Am I right in that we're just trying to do a drop-
Charlie Harrison 2016/03/08 17:13:41 I'm not sure why this operation is as flawed as yo
284 base::Int64ToString(tick_to_unix_time_ms)); 290 base::Int64ToString(tick_to_unix_time_ms));
285 } 291 }
286 292
287 // "clientInfo" key is required for some WriteToFileNetLogObserver log 293 // "clientInfo" key is required for some WriteToFileNetLogObserver log
288 // readers. Provide a default empty value for compatibility. 294 // readers. Provide a default empty value for compatibility.
289 constants_dict->Set("clientInfo", new base::DictionaryValue()); 295 constants_dict->Set("clientInfo", new base::DictionaryValue());
290 296
291 // Add a list of active field experiments. 297 // Add a list of active field experiments.
292 { 298 {
293 base::FieldTrial::ActiveGroups active_groups; 299 base::FieldTrial::ActiveGroups active_groups;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 // fine, since GetRequestStateAsValue() ignores the capture mode. 535 // fine, since GetRequestStateAsValue() ignores the capture mode.
530 NetLog::EntryData entry_data( 536 NetLog::EntryData entry_data(
531 NetLog::TYPE_REQUEST_ALIVE, request->net_log().source(), 537 NetLog::TYPE_REQUEST_ALIVE, request->net_log().source(),
532 NetLog::PHASE_BEGIN, request->creation_time(), &callback); 538 NetLog::PHASE_BEGIN, request->creation_time(), &callback);
533 NetLog::Entry entry(&entry_data, NetLogCaptureMode::Default()); 539 NetLog::Entry entry(&entry_data, NetLogCaptureMode::Default());
534 observer->OnAddEntry(entry); 540 observer->OnAddEntry(entry);
535 } 541 }
536 } 542 }
537 543
538 } // namespace net 544 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698